Last active
August 28, 2016 18:58
-
-
Save jazmon/2c9117e4225dd78b098d0cb887860cd1 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: | |
# https://atom.io/docs/latest/using-atom-basic-customization#cson | |
'.source.scss': | |
'At root': | |
'prefix': 'atroot' | |
'body': '@at-root #{&}$1' | |
'.source.js': | |
'bind js func': | |
'prefix': 'bind' | |
'body': 'this.$1 = this.$1.bind(this);$2' | |
'Debug bordering style': | |
'prefix': 'brh' | |
'body': 'borderColor: \'$1\', borderWidth: 1,$2' | |
'React Native Stylefile': | |
'prefix': 'rnstyle' | |
'body': """ | |
// @flow | |
import { StyleSheet, Dimensions, Platform } from 'react-native'; | |
const styles: Object = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: '#fff', | |
}, | |
text: { | |
color: '#000', | |
}, | |
}); | |
export default styles; | |
""" | |
'React Native Container': | |
'prefix': 'rncont' | |
'body': """ | |
// @flow | |
import React, { Component, PropTypes } from 'react'; | |
import { | |
View, | |
Text, | |
StyleSheet, | |
} from 'react-native'; | |
type Props = { | |
navigator: Object; | |
route: Object; | |
relay: Object; | |
loading: boolean; | |
}; | |
type State = { | |
text: string; | |
}; | |
// type DefaultProps = {}; | |
class $1 extends Component<*, Props, State> { | |
props: Props; | |
static propTypes = { | |
navigator: PropTypes.object.isRequired, | |
route: PropTypes.object.isRequired, | |
relay: PropTypes.object.isRequired, | |
loading: PropTypes.bool.isRequired, | |
}; | |
constructor(props: Props) { | |
super(props); | |
this.state = { | |
text: '$1', | |
}; | |
} | |
state: State; | |
render(): React.Element<*> { | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.text}>$1</Text> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
flexDirection: 'column', | |
backgroundColor: '#fff', | |
}, | |
text: { | |
color: '#000', | |
fontSize: 16, | |
}, | |
}); | |
export default $1; | |
""" | |
'React Native Component': | |
'prefix': 'rncomp' | |
'body': """ | |
// @flow | |
import React, { PropTypes } from 'react'; | |
import { | |
View, | |
Text, | |
StyleSheet, | |
} from 'react-native'; | |
const propTypes = { | |
style: View.propTypes.style, | |
text: PropTypes.string, | |
}; | |
const defaultProps = { | |
text: '', | |
}; | |
type Props = { | |
text: string; | |
}; | |
function $1(props: Props): React.Element<*> { | |
return ( | |
<View style={[styles.container, props.style]}> | |
<Text style={styles.text}>{props.text}</Text> | |
</View> | |
); | |
} | |
$1.propTypes = propTypes; | |
$1.defaultProps = defaultProps; | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
flexDirection: 'column', | |
backgroundColor: '#fff', | |
}, | |
text: { | |
color: '#000', | |
fontSize: 16, | |
}, | |
}); | |
export default $1; | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment