Skip to content

Instantly share code, notes, and snippets.

@cullophid
Last active August 29, 2015 14:16
Show Gist options
  • Save cullophid/411e3dfb9e5fb44ee202 to your computer and use it in GitHub Desktop.
Save cullophid/411e3dfb9e5fb44ee202 to your computer and use it in GitHub Desktop.
Atom snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it here:
# https://github.com/bevry/cson#what-is-cson
# javaScripst
'.source.js':
# core
'strict mode':
'prefix': 'us'
'body': '''
'use strict'
'''
'rnonymous function':
'prefix': 'f'
'body': '''
function ($1) {
$2
}
'''
'named function':
'prefix': 'fun'
'body': '''
function ${1:name} ($2) {
$3
}
'''
'if':
'prefix': 'if'
'body': '''
if ($1) {
$2
}
'''
'else if':
'prefix': 'elif'
'body': '''
else if ($1) {
$2
}
'''
'else':
'prefix': 'el'
'body': '''
else {
$1
}
'''
# Nodejs
'module.exports':
'prefix': 'me'
'body': '''
module.exports
'''
'require':
'prefix': 're'
'body': '''
require('$1');
'''
# Mocha
'describe':
'prefix': 'desc'
'body': '''
describe('$1', function () {
$2
});
'''
'it':
'prefix': 'it'
'body': '''
it('$1', function () {
$2
});
'''
'before':
'prefix': 'be'
'body': '''
before(function () {
$1
});
'''
'after':
'prefix': 'af'
'body': '''
after(function () {
$1
});
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment