Skip to content

Instantly share code, notes, and snippets.

@brettz9
Last active April 12, 2022 23:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettz9/d39bf2f394a507cb400a to your computer and use it in GitHub Desktop.
Save brettz9/d39bf2f394a507cb400a to your computer and use it in GitHub Desktop.
Atom snippets file
# 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'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson
'.source.ts':
'describe':
'prefix': 'desc'
'body': "describe('$1', () => {\n \n})"
'it':
'prefix': 'it'
'body': "it('$1', () => {\n \n})"
'arrow function':
'prefix': 'af'
'body': "() => {\n return ;\n}"
'Console log':
'prefix': 'co'
'body': 'console.log(\'$1\');'
'.source.json':
'message':
'prefix': 'm'
'body': ': {\n "message": "$1"\n},'
'.source.js':
'hyperHTMLElement':
'prefix': 'hyper'
'body': 'import HyperHTMLElement from \'../hyperhtml-element/esm/index.js\';\n\n/**\n *\n */\nclass MyElement$1 extends HyperHTMLElement {\n static get observedAttributes () { return [\'\']; }\n created () {\n }\n render () {\n return this.html``;\n }\n}\n\nMyElement.define(\'my-element\');\n\nexport default MyElement;\n'
'WebComponents':
'prefix': 'comp'
'body': 'class MyElement$1 extends HTMLElement {\n static get observedAttributes () { return [\'\']; }\n constructor () {\n super();\n const shadow = this.attachShadow({mode: \'open\'}); // `this.shadowRoot`\n shadow.append();\n }\n connectedCallback () {\n }\n disconnectedCallback () {\n }\n adoptedCallback () {\n }\n attributeChangedCallback (name, oldVal, newVal) {\n }\n}\ncustomElements.define(\'-\', MyElement); // {extends: \'ul\'}'
'cfg':
'prefix': 'cfg'
'body': '\'use strict\';\n\nmodule.exports = {\n $1\n};\n'
'JSON.stringify':
'prefix': 'json'
'body': 'JSON.stringify($1)'
'Object.keys':
'prefix': 'keys'
'body': 'Object.keys($1)'
'Promise':
'prefix': 'pr'
'body': '// eslint-disable-next-line promise/avoid-new\nreturn new Promise((resolve, reject) => {\n});'
'Grammar (Tree Sitter)':
'prefix': 'gr'
'body': '$ => (),'
'const':
'prefix': 'c'
'body': 'const '
'Console log':
'prefix': 'co'
'body': 'console.log(\'$1\');'
'Console log 2':
'prefix': 'co2'
'body': 'console.log(\'$1\')'
'console.log 3':
'prefix': 'co3'
'body': 'console.log($1)'
'async':
'prefix': 'a'
'body': '(async () => {\nawait $1();\n})();\n'
'function':
'prefix': 'f'
'body': 'function () {\n $1\n}'
'function enclosed':
'prefix': 'fe'
'body': '$1(function () {\n \n});'
'function closure':
'prefix': 'fc'
'body': "(function () {'use strict';\n\n $1\n\n}());"
'it':
'prefix': 'it'
'body': "it('$1', function () {\n \n});"
'describe':
'prefix': 'desc'
'body': "describe('$1', function () {\n \n});"
'module':
'prefix': 'm'
'body': 'module.exports = function () {\n\n $1\n\n};'
'switch':
'prefix': 'switch'
'body': "switch ($1) {\ncase '':\n break;\ndefault:\n break;\n}"
'return':
'prefix': 'ret'
'body': 'return$1;'
'return jsdoc':
'prefix': 'r'
'body': '@returns {void$1}'
'for':
'prefix': 'f'
'body': 'var i = 0, len = $1;\nfor (i = 0; i < len; i++) {\n \n}'
'if':
'prefix': 'if'
'body': 'if ($1) {\n \n}'
'if-else':
'prefix': 'ife'
'body': 'if ($1) {\n \n}\nelse {\n \n}'
'while':
'prefix': 'w'
'body': 'while ($1) {\n \n}'
# For eslint tests (`eslint-plugin-jsdoc`)
'invalid':
'prefix': 'invalid'
'body': '{\n code: `\n `,\n errors: [{\n line: \'\',\n message: \'\',\n }],\n},'
'istanbul':
'prefix': 'ist'
'body': '// istanbul ignore next'
'eslint':
'prefix': 'es'
'body': "// eslint-disable-next-line "
'cli':
'prefix': 'cli'
'body': "// eslint-disable-next-line no-console -- CLI"
'jsdoc':
'prefix': 'jsdoc'
'body': '/**\n * $1\n */'
'type':
'prefix': 'type'
'body': '/** @type {$1} */ '
'typedef':
'prefix': 'typedef'
'body': '/**\n* @typedef {$1} \n*/'
'jd':
'prefix': 'jd'
'body': '/**\n* @$1\n*/'
'undef':
'prefix': 'undef'
'body': '@returns {undefined}'
'undefined':
'prefix': 'un'
'body': '/**\n* $1\n* @returns {undefined}\n*/'
'param':
'prefix': 'p'
'body': '@param {$1} '
'.text.html.basic':
'HTML document':
'prefix': 'ht'
'body': '<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n <meta charset="utf-8" /><link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">\n</head>\n<body>\n\n$1\n\n</body>\n</html>\n'
'HTML document 2':
'prefix': 'h'
'body': '<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n <meta charset="utf-8" />\n</head>\n<body>\n\n$1\n\n</body>\n</html>\n'
'HTML document with script':
'prefix': 'hs'
'body': '<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n <meta charset="utf-8" />\n</head>\n<body>\n\n<script>\n$1\n</script>\n\n</body>\n</html>\n'
'HTML for anchor':
'prefix': 'anchor'
'body': '<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n <meta charset="utf-8" />\n <title>Redirect</title>\n <script>\n\n// If the user has JavaScript and clicks on the link\n// intead of just waiting (e.g., if the second script\n// hasn\'t yet loaded due to a slow connection), ensure\n// we include the anchor\nwindow.addEventListener(\'click\', function (e) {\n e.preventDefault();\n if (e.target.href) { // Ignore stray clicks\n location =\ne.target.href + location.hash;\n }\n}, true);\n\n </script>\n</head>\n<body>\n\n<!-- Customize the href value using your redirect target\'s base URL. -->\nRedirecting to <a id="redirect" href="http://example.com/somepage/">\n a new location\n</a>...\n\n<script>\ndocument.getElementById(\'redirect\').click();\n</script>\n\n</body>\n</html>\n'
'a href':
prefix: 'a'
body: '<a href="#">$1</a>'
'h1':
'prefix': 'h1'
'body': '<h1>$1</h1>'
'h2':
'prefix': 'h2'
'body': '<h2>$1</h2>'
'h3':
'prefix': 'h3'
'body': '<h3>$3</h3>'
'h4':
'prefix': 'h4'
'body': '<h4>$1</h4>'
'h5':
'prefix': 'h5'
'body': '<h5>$1</h5>'
'h6':
'prefix': 'h6'
'body': '<h6>$1</h6>'
'jscript':
'prefix': 'script'
'body': '<script>$1</script>'
'script':
'prefix': 's'
'body': '<script>$1</script>'
'script src':
'prefix': 'ss'
'body': '<script src="$1"></script>'
'div':
'prefix': 'div'
'body': '<div>$1</div>'
'd':
'prefix': 'd'
'body': '<div>$1</div>'
'div class':
'prefix': 'div'
'body': '<div class="$1"></div>'
'div id':
'prefix': 'di'
'body': '<div id=""></div>'
'em':
'prefix': 'em'
'body': '<em>$1</em>'
'li':
'prefix': 'li'
'body': '<li>$1</li>'
'ul':
'prefix': 'ul'
'body': '<ul>$1</ul>'
'ol':
'prefix': 'ol'
'body': '<ol>$1</ol>'
'p':
'prefix': 'p'
'body': '<p>$1</p>'
'span':
'prefix': 'span'
'body': '<span>$1</span>'
'strong':
'prefix': 'strong'
'body': '<strong>$1</strong>'
'style':
'prefix': 'style'
'body': '<style>$1</style>'
'table':
'prefix': 'table'
'body': 'table>$1</table>'
'td':
'prefix': 'td'
'body': '<td>$1</td>'
'tr':
'prefix': 'tr'
'body': '<tr>$1</tr>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment