Last active
November 6, 2017 20:21
-
-
Save adamellsworth/aab04fb4a5eb9c772074 to your computer and use it in GitHub Desktop.
Collection of my commonly used snippets in Atom
This file contains hidden or 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
'.source.js*': | |
'Module Exports': | |
'prefix': 'mx' | |
'body': ''' | |
module.exports = ${1}; | |
''' | |
'Export Default': | |
'prefix': 'ed' | |
'body': ''' | |
export default ${1}; | |
''' | |
'Class Name': | |
'prefix': 'cn' | |
'body': ''' | |
className="$1" | |
''' | |
'this.props': | |
'prefix': 'tp' | |
'body': ''' | |
this.props | |
''' | |
'this.state': | |
'prefix': 'ts' | |
'body': ''' | |
this.state | |
''' | |
'Expose State Els': | |
'prefix': 'cs' | |
'body': ''' | |
const { $1 } = this.state; | |
''' | |
'Expose Prop Els': | |
'prefix': 'cp' | |
'body': ''' | |
const { $1 } = this.props; | |
''' | |
'Import': | |
'prefix': 'imp' | |
'body': ''' | |
import $1 from '$1'; | |
''' | |
'Import (Different Names)': | |
'prefix': 'impd' | |
'body': ''' | |
import $1 from '$2'; | |
''' | |
'Object Key Map': | |
'prefix': 'okm' | |
'body': ''' | |
Object.keys($1).map(function ($2, index) { | |
$3 | |
}, this); | |
''' | |
'Array Map': | |
'prefix': 'arm' | |
'body': ''' | |
map(function ($1, index) { | |
$2 | |
}, this); | |
''' | |
'Object Keys': | |
'prefix': 'oks' | |
'body': ''' | |
Object.keys($1) | |
''' | |
'Object Has Property': | |
'prefix': 'hop' | |
'body': ''' | |
hasOwnProperty($1) | |
''' | |
'JSON stringify': | |
'prefix': 'jss' | |
'body': ''' | |
JSON.stringify($1); | |
''' | |
'JSON parse': | |
'prefix': 'jsp' | |
'body': ''' | |
JSON.parse($1); | |
''' | |
'Unit Test Template': | |
'prefix': 'utt' | |
'body': ''' | |
{ | |
name: "$1", | |
action: function (assert, $2) { | |
assert.$3( | |
$4, | |
this.name | |
) | |
} | |
} | |
''' | |
'React ES6 Component': | |
'prefix': 'rc6' | |
'body': ''' | |
import React, { Component } from 'react'; | |
import * as pt from 'prop-types'; | |
class ${1:MyComponent} extends Component { | |
constructor (props) { | |
super(props); | |
} | |
render () { | |
return (<div> | |
</div>); | |
} | |
} | |
${1}.propTypes = {}; | |
export default ${1}; | |
''' | |
'React ES6 Functional Component': | |
'prefix': 'rc6f' | |
'body': ''' | |
import React from 'react'; | |
import * as pt from 'prop-types'; | |
export default function ${1} (props) { | |
return (<div> | |
${2} | |
</div>); | |
} | |
${1}.propTypes = {}; | |
''' | |
'React ES6 bind method to this': | |
'prefix': 'rb', | |
'body': ''' | |
this.${1} = this.${1}.bind(this); | |
''' | |
'React ES6 Higher Order Component': | |
'prefix': 'hoc', | |
'body': ''' | |
import React, { Component } from 'react'; | |
import xtend from 'xtend'; | |
export default function ${1} (WrappedComponent) { | |
return class extends Component { | |
constructor (props) { | |
super(props); | |
} | |
render () { | |
return React.createElement( | |
WrappedComponent, | |
xtend({}, this.props), | |
this.props.children || [] | |
); | |
} | |
}; | |
} | |
''' | |
'Invintus Modal': | |
'prefix': 'mdl' | |
'body': ''' | |
<Modal | |
saveAction={<button className="btn btn-success" onClick={this.$1}> | |
<i className="fa fa-save"/> Save | |
</button>} | |
cancelModal={this.$2}> | |
<Modal.Header>$3</Modal.Header> | |
<Modal.Body> | |
$4 | |
</Modal.Body> | |
<Modal.Footer></Modal.Footer> | |
</Modal> | |
''' | |
'Bootstrap 3 Modal': | |
'prefix': 'bmdl' | |
'body': ''' | |
<Modal animation={false} bsSize="large" show={this.state.$1} onHide={this.$2}> | |
<Modal.Header> | |
<Modal.Title>$3</Modal.Title> | |
</Modal.Header> | |
<Modal.Body> | |
</Modal.Body> | |
<Modal.Footer> | |
<button className="btn btn-default" onClick={this.$2}>Cancel</button> | |
</Modal.Footer> | |
</Modal> | |
''' | |
'.php': | |
'Phalcon Logger': | |
'prefix': 'pl' | |
'body': ''' | |
parent::log($1); | |
''' | |
'var_dump+die': | |
'prefix': 'vdd' | |
'body': ''' | |
var_dump($1);die; | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment