Skip to content

Instantly share code, notes, and snippets.

@PedroBern
Last active December 20, 2019 19:30
Show Gist options
  • Save PedroBern/501f5fad4d5983fe82d79905886e5694 to your computer and use it in GitHub Desktop.
Save PedroBern/501f5fad4d5983fe82d79905886e5694 to your computer and use it in GitHub Desktop.
My atom config files
"*":
core:
telemetryConsent: "no"
themes: [
"one-light-ui"
"one-light-syntax"
]
diagrams:
previewWidth: 536
editor:
invisibles: {}
"exception-reporting":
userId: "f0299730-7475-4ffa-adbc-381a62aacbbf"
"external-open":
extensions: [
"xlsx"
]
"git-plus":
general: {}
remoteInteractions: {}
github: {}
"highlight-registered-keyword":
autoMark: true
patternsFilePath: "/Users/pedrober/atomcson/atomcson.cson"
"linter-ui-default":
panelHeight: 300
"markdown-mindmap": {}
"prettier-atom":
formatOnSaveOptions:
enabled: true
"tree-view":
hideIgnoredNames: true
welcome:
showOnStartup: false
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
#
# 'atom-text-editor':
# 'enter': 'editor:newline'
#
# 'atom-workspace':
# 'ctrl-shift-p': 'core:move-up'
# 'ctrl-p': 'core:move-down'
#
# You can find more inforation about keymaps in these guides:
# * http://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-keybindings
# * http://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/
#
# If you're having trouble with your keybindings not working, try the
# Keybinding Resolver: `Cmd+.` on macOS and `Ctrl+.` on other platforms. See the
# Debugging Guide for more information:
# * http://flight-manual.atom.io/hacking-atom/sections/debugging/#check-the-keybindings
#[sdsdsdsdds
#sdsdsdsdds
#]
# 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/#configuring-with-cson
'atom-text-editor':
'ctrl-shift-cmd-b':"bookmarks:toggle-bookmark"
'ctrl-shift-cmd-n':"bookmarks:jump-to-next-bookmark"
'ctrl-shift-cmd-p':"bookmarks:jump-to-previous-bookmark"
'ctrl-shift-cmd-l':"bookmarks:view-all"
'f1':"tree-view:toggle"
'f4':"editor:toggle-line-comments"
'f5':"editor:duplicate-lines"
'f6':"editor:duplicate-lines"
'f7':"find-and-replace:select-undo"
'f8':"find-and-replace:select-all"
'f9':"find-and-replace:select-next"
'f10':"editor:delete-line"
'home':'editor:move-line-up'
'end':'editor:move-line-down'
'f13':"bracket-matcher:select-inside-brackets"
'f14':'jsx-comment:toggleComment'
'f15':"wrap-in-tag:wrap"
'f17':'editor:upper-case'
'f18':'editor:lower-case'
'ctrl-enter':'go-to-line:toggle'
'atom-workspace':
'ctrl-shift-cmd-m': 'markdown-mindmap:toggle'
# Key bindings for multi-cursor-plus
'ctrl-alt-cmd-c': 'multi-cursor-plus:mark'
'ctrl-alt-cmd-up': 'multi-cursor-plus:move-up'
'ctrl-alt-cmd-down': 'multi-cursor-plus:move-down'
'ctrl-alt-cmd-left': 'multi-cursor-plus:move-left'
'ctrl-alt-cmd-right': 'multi-cursor-plus:move-right'
'f16':'maximize-panes:maximize'
'clear':'core:close'
'f19':'github:toggle-git-tab'
'f2 up': 'pane:split-up-and-copy-active-item'
'f2 down': 'pane:split-down-and-copy-active-item'
'f2 left': 'pane:split-left-and-copy-active-item'
'f2 right': 'pane:split-right-and-copy-active-item'
'f3 up': 'window:focus-pane-above'
'f3 down': 'window:focus-pane-below'
'f3 left': 'window:focus-pane-on-left'
'f3 right': 'window:focus-pane-on-right'
'pageup':'fuzzy-finder:toggle-file-finder'
'pagedown':'tree-view:toggle-focus'
# 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.js, .source.jsx':
'describe':
'prefix': 'des'
'body': '''
describe('${1:description}', () => {
${2}
});
'''
'material breakpoints up':
'prefix': 'mbu'
'body': '''
[theme.breakpoints.up('${1:Screen}')]: {
${2:Style}: ${3:Value},
},
'''
'material breakpoints down':
'prefix': 'mbd'
'body': '''
[theme.breakpoints.down('${1:Screen}')]: {
${2:Style}: ${3:Value},
},
'''
'log group':
'prefix': 'logg'
'body': '''
console.group('${1:Label}');
console.log('${2:To log}');
console.groupEnd()
'''
'material-ui import':
'prefix':'imm'
'body':'''
import ${1:Component} from '@material-ui/core/${1:Component}';
'''
'material-ui import icon':
'prefix':'immi'
'body':'''
import ${1:icon}Icon from '@material-ui/icons/${1:icon}';
'''
'nice comment':
'prefix':'co'
'body':'''
/**
*
*
*/
'''
'nice comment big':
'prefix':'cob'
'body':'''
/**
*
*
*
*
*
*
*
*
*/
'''
'React pure functional with context':
'prefix': 'r-pfc'
'body': '''
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import { AppContext, connectContext } from '../context'
const styles = theme => ({
})
const ${1} = React.memo(({
classes,
${2},
}) => {
return(
)
});
${1}.defaultProps = {
};
${1}.propTypes = {
classes: PropTypes.object.isRequired,
};
function select() {
const { ${2} } = useContext(AppContext);
return {
${2}: ${2}
};
}
export default connectContext(withStyles(styles)(${1}),select);
'''
'this.setState({})':
'prefix': 'se'
'body': "this.setState({${1:name}: ${1:name}});"
'import from ./':
'prefix': 'im'
'body': "import $1 from './$1';"
'Redux fetch action creator':
'prefix': 'x-a'
'body': '''
export const fetch${1:Something} = (${2:inputs}) => {
return (dispatch, getState) => {
dispatch(request${1:Something}())
return fetch(${3:urlToFetch})
.then(
response => response.json(),
error => console.log('An error occurred.', error)
)
.then(json =>
dispatch(receive${1:Something}(json, ${2:inputs}))
)
}
}
'''
'React life cycle ComponentDidMount':
'prefix': 'dm'
'body': '''
componentDidMount(){
$1
}
'''
'React life cycle ComponentDidUpdate':
'prefix': 'du'
'body': '''
componentDidUpdate(){
$1
}
'''
'React life cycle ComponentWillUnmount':
'prefix': 'wu'
'body': '''
componentWillUnmount(){
$1
}
'''
'React life cycle getDerivedStateFromProps':
'prefix': 'gd'
'body': '''
static getDerivedStateFromProps(newProps, state){
if (newProps.$1 !== state.$1 ){
}
else return null
}
'''
'React stateless':
'prefix': 'r-f'
'body': '''
import React from 'react';
import PropTypes from 'prop-types';
function ${1}(props) {
return(
);
};
${1}.defaultProps = {
};
${1}.propTypes = {
};
export default ${1};
'''
'React stateless with material simple':
'prefix': 'r-fms'
'body': '''
function ${1}(props){
const { classes } = props;
return(
);
}
${1}.defaultProps = {
};
${1}.propTypes = {
classes: PropTypes.object.isRequired,
};
${1} = withStyles(styles)(${1});
'''
'React stateless with material':
'prefix': 'r-fm'
'body': '''
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
const styles = theme => ({
})
function ${1}(props){
const { classes } = props
return(
);
}
${1}.defaultProps = {
};
${1}.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(${1});
'''
'React statefull':
'prefix': 'r-c'
'body': '''
import React from 'react';
import PropTypes from 'prop-types';
class ${1} extends React.Component {
state = {
}
render() {
return (
);
}
}
${1}.defaultProps = {
};
${1}.propTypes = {
};
export default ${1};
'''
'React statefull with material':
'prefix': 'r-cm'
'body': '''
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
const styles = theme => ({
})
class ${1} extends React.Component {
state = {
}
render() {
const { classes } = this.props;
return (
);
}
}
${1}.defaultProps = {
};
${1}.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(${1});
'''
'React statefull with redux':
'prefix': 'r-cr'
'body': '''
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
class ${1} extends React.Component {
state = {
}
render() {
return (
);
}
}
${1}.defaultProps = {
};
${1}.propTypes = {
};
const mapStateToProps = state => {
return {
};
}
const mapDispatchToProps = dispatch => {
return {
};
}
export default connect(mapStateToProps, mapDispatchToProps)(${1});
'''
'React statefull with material and redux':
'prefix': 'r-cmr'
'body': '''
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import { withStyles } from '@material-ui/core/styles';
const styles = theme => ({
})
class ${1} extends React.Component {
state = {
}
render() {
const { classes } = this.props;
return (
);
}
}
${1}.defaultProps = {
};
${1}.propTypes = {
classes: PropTypes.object.isRequired,
};
const mapStateToProps = state => {
return {
};
}
const mapDispatchToProps = dispatch => {
return {
};
}
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(${1}));
'''
'.source.python':
'def test function':
'prefix': 'dt'
'body': '''
def test_${1:function_name}(self):
\t"""about
\t"""
\tpass
'''
'def python regular function':
'prefix': 'df'
'body': '''
def ${1:function_name}():
\t"""
\t\t@totest
\t"""
\tpass
'''
'def django overide save':
'prefix': 'djoversave'
'body': '''
def save(self, *args, **kwargs):
\t"""
\t\tNew save method
\t\t@totest
\t"""
\tsuper(${1:model_name}, self).save(*args, **kwargs)
'''
'django test template':
'prefix': 'testtemplate'
'body': '''
class ${1:class_name}(TestCase):
\t@classmethod
\tdef setUpClass(self):
\t\tpass
\t@classmethod
\tdef tearDownClass(self):
\t\tpass
\tdef setUp(self):
\t\tpass
\tdef tearDown(self):
\t\tpass
'''
'django model':
'prefix': 'djmodel'
'body': '''
class ${1:model_name}(models.Model):
\t"""
\t\tDescription
\t"""
\tfield = models.Field()
\tclass Meta:
\t\tordering = ()
\tdef __str__(self):
\t\treturn f"{self.pk}"
'''
'django test template full':
'prefix': 'testtemplatefull'
'body': '''
from django.test import TestCase
class ${1:class_name}(TestCase):
\t@classmethod
\tdef setUpClass(self):
\t\tpass
\t@classmethod
\tdef tearDownClass(self):
\t\tpass
\tdef setUp(self):
\t\tpass
\tdef tearDown(self):
\t\tpass
'''
'separator':
'prefix': 'sep'
'body': '''
# ---------------------------------------------------------------------------- #
'''
'separator with comment':
'prefix': 'sepco'
'body': '''
# ---------------------------------------------------------------------------- #
"""
\t${1:comment}
"""
# ---------------------------------------------------------------------------- #
'''
'comment':
'prefix': 'co'
'body': '''
"""
\t${1:comment}
"""
'''
'objects.all()':
'prefix': 'oa'
'body': '''.objects.all()'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment