Created
August 23, 2017 14:07
-
-
Save c0d0g3n/da95e36b49ca761460684c23ecc1e9f8 to your computer and use it in GitHub Desktop.
my atom snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.gfm': | |
'thin arrow right': | |
'prefix': '->' | |
'body': '→' | |
'thin arrow left': | |
'prefix': '<-', | |
'body': '←' | |
'thin arrow left right': | |
'prefix': '<->', | |
'body': '↔' | |
'.source.js.jsx': | |
'import react': | |
'prefix': 'ir' | |
'body': """ | |
import React from 'react' | |
${1:import PropTypes from 'prop-types'}$2 | |
""" | |
'react class': | |
'prefix': 'rc' | |
'body': """ | |
export default class ${1:ComponentName} extends React.Component { | |
render () { | |
return ( | |
${2:<div>${3:$1}</div>} | |
) | |
} | |
static propTypes = {$4} | |
} | |
""" | |
'react function': | |
'prefix': 'rf' | |
'body': """ | |
const ${1:ComponentName} = () => | |
${2:<div>$1</div>} | |
${1:ComponentName}.propTypes = {$3} | |
export default $1 | |
""" | |
'extend constructor': | |
'prefix': 'ec' | |
'body': """ | |
constructor (${1:props}) { | |
super(${1:props}) | |
$2 | |
}$3 | |
""" | |
'mapStateToProps': | |
'prefix': 'msf' | |
'body': 'const mapStateToProps = (state$1) =>$2' | |
'mapDispatchToProps': | |
'prefix': 'mdf' | |
'body': 'const mapDispatchToProps = (dispatch$1) =>$2' | |
'reducer': | |
'prefix': 'red' | |
'body': """ | |
const initial = {$2} | |
export default ($1State = initial, action) => { | |
switch (action.type) {$3 | |
default: { | |
return $1State | |
} | |
} | |
} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment