Skip to content

Instantly share code, notes, and snippets.

@OzTamir
Last active November 22, 2016 09:00
Show Gist options
  • Save OzTamir/23739a71060dc3b42e6723d3806154f1 to your computer and use it in GitHub Desktop.
Save OzTamir/23739a71060dc3b42e6723d3806154f1 to your computer and use it in GitHub Desktop.
Sublime Text Snippets for JavaScript
<snippet>
<content><![CDATA[console.log(${1: ">>> This is a debug message from $TM_FILENAME:$TM_LINE_NUMBER <<<< "});
debugger;]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>cdbg</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<description>console.log() and a breakpoint</description>
</snippet>
<snippet>
<content><![CDATA[console.log(${1: ">>> This is a debug message from $TM_FILENAME:$TM_LINE_NUMBER <<<< "});]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>cog</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<description>Superpowered console.log()</description>
</snippet>
<snippet>
<content><![CDATA[filter(function(obj) { return obj.${1}; })]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>filterBy</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<description>Filter an array by property</description>
</snippet>
<snippet>
<content><![CDATA[map(function(obj) { return obj.${1}; })]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>mapTo</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<description>Map array children's proprties</description>
</snippet>
<snippet>
<content><![CDATA[reduce(function(objA, objB) { return ${1: /* the condition for the reduce */} ? objA : objB; })]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>reduceBy</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<description>Reduce an array by condition</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment