Skip to content

Instantly share code, notes, and snippets.

@tonysaffo
Created November 16, 2018 16:52
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 tonysaffo/75da92eb805537d48e4949cf0f0dc68f to your computer and use it in GitHub Desktop.
Save tonysaffo/75da92eb805537d48e4949cf0f0dc68f to your computer and use it in GitHub Desktop.
Atom js snippets
'.source.js':
'anonymous function':
'prefix': 'f'
'body': 'function(){$1}'
'jquery click function':
'prefix': 'c'
'body': """
.click(function(){
${1}
});
"""
'delegate click':
'prefix': 'd'
'body': """
$(document).delegate('${1}', "click", function(e){
${2}
});
"""
'jquery onload':
'prefix': 'l'
'body': """
$(function(){
${1}
});
"""
'for loop':
'prefix': 'ff'
'body': """
for(var i = 0; i < ${1}.length; i++){
${2}
}
"""
'try catch':
'prefix': 'try'
'body': """
try{
} catch(err) {
console.error('ERROR EXCEPTION IN TRY CATCH ${1}', err)
}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment