Skip to content

Instantly share code, notes, and snippets.

@stephen-james
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephen-james/8842213 to your computer and use it in GitHub Desktop.
Save stephen-james/8842213 to your computer and use it in GitHub Desktop.
Handy JavaScript snippets for Visual Studio
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>Immediately Invoked Function Expression</Title>
<Author>Stephen James (@stephenhjames)</Author>
<Shortcut>iife</Shortcut>
<Description>Code snippet for an Immediately-Invoked Function Expression</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Code Language="JavaScript"><![CDATA[(function() {
$selected$$end$
}());]]></Code>
</Snippet>
</CodeSnippet>
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>jQuery document.ready wrapping function</Title>
<Author>Stephen James (@stephenhjames)</Author>
<Shortcut>jqready</Shortcut>
<Description>Code snippet for creating a jQuery document.ready wrapping function</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
</Declarations>
<Code Language="JavaScript"><![CDATA[$$(function () {
$selected$$end$
});]]></Code>
</Snippet>
</CodeSnippet>
<CodeSnippet Format="1.1.0"
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>Revealing Module IIFE</Title>
<Author>Stephen James (@stephenhjames)</Author>
<Shortcut>rvm</Shortcut>
<Description>Code snippet for creating a revealing module immediately
invoked function expression</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>moduleName</ID>
<ToolTip>Module Name</ToolTip>
<Default>myModule</Default>
</Literal>
</Declarations>
<Code Language="JavaScript"><![CDATA[var $moduleName$ = (function () {
$selected$$end$
return {
}
}());]]></Code>
</Snippet>
</CodeSnippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment