Skip to content

Instantly share code, notes, and snippets.

@nyl2k8
Last active July 12, 2019 10:04
# 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.sass, .source.css.sass':
'Media':
'prefix': '@media-break'
'body': '@media screen and #{breakpoint(medium)} { \n $1\n}'
'.text.html, .text.html.php':
'PDO Block':
'prefix': 'pdo'
'body': """$sql = "${1}";
$sth = $dbh->prepare($sql);
$sth->bindValue(\':id\', $val);
if($sth->execute()){
if($sth->rowCount() > 0){
$data = $sth->fetch(PDO::FETCH_OBJ);
}
}
"""
'Basic Array':
'prefix': 'barr'
'body': '$${1} = array(${2});'
'Array Key Value':
'prefix': 'kvr'
'body': "'${1}' => '${2}',"
'Function Comment Block':
'prefix': 'cmt'
'body': """/**
* A brief description of the function.
*
* @param type $var
* @return void change if needed.
*/
"""
'Var Dump':
'prefix': 'vd'
'body': """echo \"<PRE>\";
var_dump(${1});
"""
'Print Readable':
'prefix': 'pr'
'body': 'print_r(${1});'
'Method Line Break':
'prefix': 'mlb'
'body': '// --------------------------------------------------------------------'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment