Skip to content

Instantly share code, notes, and snippets.

@mcfog
Last active August 29, 2015 14:00
Show Gist options
  • Save mcfog/11376609 to your computer and use it in GitHub Desktop.
Save mcfog/11376609 to your computer and use it in GitHub Desktop.
my sublime snippets for js
<snippet>
<content><![CDATA[
function(${1:arg}) {
${2}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>-></tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
${1:func}.apply(this, arguments);
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>apply</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
var ${1:class} = (function() {
function ${1:class} () {
}
var proto = ${1:class}.prototype;
return ${1:class};
})();
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>class</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
(function(${1}) {
${2://logic}
})(${3});
${4}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>iife</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
var ${1:name} = require('${1}${2}');
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>req</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
<snippet>
<content><![CDATA[
var ${1:Class} = (function(parent) {
function ${1:Class} () {
parent.apply(this, arguments);
}
var proto = ${1:Class}.prototype = Object.create(parent.prototype);
return ${1:Class};
})(${2:Base});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>subclass</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment