Skip to content

Instantly share code, notes, and snippets.

@lencioni
Last active August 29, 2015 14:09
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 lencioni/230b8e61ae6d08898aac to your computer and use it in GitHub Desktop.
Save lencioni/230b8e61ae6d08898aac to your computer and use it in GitHub Desktop.
require() JavaScript snippet
snippet re "require" b
var `!p
def formatVariableName(path):
lastPart = path.split('/')[-1]
if lastPart == 'underscore':
return '_'
elif lastPart == 'jquery':
return '$'
else:
return re.sub(r'[_\-]', '', lastPart.title())
snip.rv = formatVariableName(t[1])
` = require('${1}');$0
endsnippet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment