Skip to content

Instantly share code, notes, and snippets.

@danielhutchinson
Last active August 29, 2015 14:19
Show Gist options
  • Save danielhutchinson/6e5476d7ede8ade2e2a8 to your computer and use it in GitHub Desktop.
Save danielhutchinson/6e5476d7ede8ade2e2a8 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
# JavaScript Snippets
# Standard Snippets
'.source.js':
'Console Log':
'prefix': 'cl'
'body': 'console.log($1);$0'
'Console Dir':
'prefix': 'cd'
'body': 'console.dir($1);$0'
'JSON Stringify':
'prefix': 'jstring'
'body': 'JSON.stringify($1);$0'
'JSON Stringify + Console Log':
'prefix': 'cljs'
'body': 'console.log(JSON.stringify($1));$0'
'Import Statement (ES6)':
'prefix': 'import'
'body': "import $1 from '$2';$0"
'Global Function':
'prefix': 'func'
'body': 'function $1($2) {\n $3\n}'
'Var function':
'prefix': 'var func'
'body': 'var $1 = function($2) {\n $3\n}'
'Anonymous function':
'prefix': 'afunc'
'body': 'function($1) {\n $2\n}'
'Object function':
'prefix': 'ofunc'
'body': '$1: function($2) {\n $3\n}'
# Ember Snippets
'Ember Module Setup':
'prefix': 'impem'
'body': "import Ember from 'ember';\n\nexport default Ember.$1.$2({\n\t$3\n});"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment