Skip to content

Commit

Permalink
Rename HTML5 to html.html5; Rename JS-ConsoleLog to js.console-log; A…
Browse files Browse the repository at this point in the history
…dd gitignore snippet, js.function, js.module and js.module.gettersetter
  • Loading branch information
karimmaassen committed Mar 30, 2013
1 parent 537d770 commit 126072a
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 2 deletions.
36 changes: 36 additions & 0 deletions gitignore.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<snippet>
<content><![CDATA[
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
*.sass-cache
# tasks
*.tasks
*.todo
# OS or Editor folders
.DS_Store
Thumbs.db
.cache
.project
.settings
.tmproj
*.esproj
*.sublime-project
*.sublime-workspace
# Folders to ignore
.svn
.idea
]]></content>
<tabTrigger>.gitignore</tabTrigger>
<description>Default .gitignore</description>
</snippet>
8 changes: 6 additions & 2 deletions html5.sublime-snippet → html.html5.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<h1>${3:Hello World}</h1>
${0}
<h1>${4:Hello World}</h1>
${0://go!}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
${3:<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>}
</body>
</html>
]]></content>
<tabTrigger>html5</tabTrigger>
<scope>text.html</scope>
<description>HTML5 Quick Start + jQuery</description>
</snippet>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ console.log('${1}');${0}
<tabTrigger>cl</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<description>console.log()</description>
</snippet>
11 changes: 11 additions & 0 deletions js.function.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<content><![CDATA[
function ${1:name}( ${2:variables} ) {
${0:return true;}
}
]]></content>
<tabTrigger>function</tabTrigger>
<scope>source.js</scope>
<description>function() {return true}</description>
</snippet>
64 changes: 64 additions & 0 deletions js.module.gettersetter.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<snippet>
<content><![CDATA[${1:// x = object
${3:x}: function( key, value ){
if ( key ) {
var t = typeof key;
if ( t === 'object' ) {
return _x = \$.extend( {\}, _x, key );
\} else if ( t === 'string' && value ) {
var obj = {\};
obj[key] = value;
return _x = \$.extend( {\}, _x, obj );
\} else if ( t === 'string') {
return _x[input];
\} else {
return false;
\}
\} else {
return _x;
\}
\}}${2:,
// x = string or number
${4:x}: function( value ){
if ( value ) {
var t = typeof value;
if ( t === 'string') {
return _y = value;
\} else if ( t === 'number') {
return _y = value;
\} else {
return false;
\}
\} else {
return _y;
\}
\}}
]]></content>
<tabTrigger>module.getset</tabTrigger>
<scope>source.js</scope>
<description>Module part: Getter / Setter</description>
</snippet>
49 changes: 49 additions & 0 deletions js.module.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<snippet>
<content><![CDATA[
var ${1:Module} = function( options ) {
var _privateValue = 10;
var _private = ( typeof options == 'object' ) ? \$.extend( {}, _defaults, options ) : options;
function _privateFunction( ) {
return true;
}
function ${1:Module}() {
this._private = _private; // Private only by convention
this.instanceValue = 10; // Instance propertie
}
${1:Module}.prototype = {
init: function( options ) {
var self = this;
console.log( 'init with options: ', options );
},
machine = {
speak: function(){
return 'hello';
},
stop: function(){
console.log('Stop');
}
}
}
return new ${1:Module}();
}
]]></content>
<tabTrigger>module</tabTrigger>
<scope>source.js</scope>
<description>Module + Closure</description>
</snippet>

0 comments on commit 126072a

Please sign in to comment.