Last active
February 22, 2018 22:17
-
-
Save davidsword/1d8ce45df19d824b7eecd1a660120ec3 to your computer and use it in GitHub Desktop.
⚛️🔥 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
# as of 20180222 | |
# Your snippets | |
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson | |
# ALL ---------------------------------------------------------- | |
'.source.css, .source.html, .source.php, .source.txt, .source.md, .source.less, .source.sass, .source.scss, .source.js, .source.*, .source' : | |
'Cheat Sheets' : | |
'prefix' : 'cheat' | |
'body' : """ | |
// LAMP - https://gist.github.com/davidsword/3256ba0b8371f66d9d0da3144f5a40f8 | |
// HTACCESS - https://gist.github.com/davidsword/f44f456df878fc2f39ef71e700d0ae52 | |
// Terminal - https://gist.github.com/davidsword/8f9473242c53824c9481e17ac427069a | |
// MySQL - https://gist.github.com/davidsword/c6f0314c4b41f11783f5f955c049b86d | |
""" | |
'raquo' : | |
'prefix' : 'raquo' | |
'body' : '&:after { content: " \👋00BB"; }' | |
'Google API Key for Maps' : | |
'prefix' : 'googlekey' | |
'body' : 'AIzaSyAY7P1GfSoUnfv0xf34TiVOvjfB3hHkhZc' | |
'Ratios' : | |
'prefix' : 'ratio' | |
'body' : """ | |
// newW = (oldW / oldH)*newH; | |
// newH = (oldH / oldW)*newW;' | |
""" | |
'markdown' : | |
'prefix' : 'md' | |
'body': """ | |
[I'm an inline-style link](https://www.google.com) | |
![alt text](https://icon42.png) | |
# H1 | |
## H2 ect | |
Alt-H1 | |
====== | |
Alt-H2 | |
------ | |
*italic* or _italic-alt_ | |
**strong** or __strong__ | |
~~strikethrough~~ | |
```javascript | |
code | |
``` | |
inline `code` | |
| Tables | Are | Cool | | |
| ------------- |:-------------:| -----:| | |
| col 3 is | right-aligned | $1600 | | |
> blockquote | |
// line breaks | |
--- | |
*** | |
___ | |
""" | |
# PHP ---------------------------------------------------------- | |
'.source.php' : | |
'blockdoc' : | |
'prefix' : 'blockdoc' | |
'body' : """ | |
/** | |
* | |
* | |
* @param | |
* @access public | |
* @since 1.0.0 | |
* @version 1.0.0 | |
* | |
* @return | |
*/ | |
""" | |
'abspath' : | |
'prefix' : 'abspath' | |
'body' : 'defined("ABSPATH") || exit;' | |
'PHP Object' : | |
'prefix' : 'object' | |
'body' : """ | |
ob_start(); | |
//.. | |
return ob_get_clean(); | |
""" | |
'timezone' : | |
'prefix' : 'timezone' | |
'body' : 'date_default_timezone_set("America/Vancouver");' | |
'Show Errors' : | |
'prefix' : 'errors' | |
'body' : """ | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
ini_set("display_startup_errors",1); | |
""" | |
'Enque Scripts' : | |
'prefix' : 'enque' | |
'body' : """ | |
add_action( "wp_enqueue_scripts", function(){ | |
// add_action( "admin_enqueue_scripts", function(){ | |
// $screen = get_current_screen(); | |
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer); | |
// plugins_url( 'css/mycss.css', __FILE__ ) | |
// plugins_url( 'css/mycss.css', __FILE__ ) | |
// dirname( __FILE__ ) . '/css/mycss.css' | |
// plugin_dir_path( __FILE__ )."/css/mycss.css" | |
// | |
// filemtime( plugin_dir_path( __FILE__ )."/file.js" ) | |
// filemtime( get_template_directory()."/file.js" ) | |
add_action( "wp_footer", function(){ | |
wp_enqueue_style( $handle, $src, $deps, $ver, $media ); | |
}); | |
}); | |
""" | |
'CURL' : | |
'prefix' : 'curl' | |
'body' : """ | |
// curl page | |
function myplugin_curl_page($id) { | |
$url = get_permalink($url); | |
$ch = curl_init($url) or die("curl issue"); | |
$curl_options = array( | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_HEADER => false, | |
CURLOPT_FOLLOWLOCATION => false, | |
CURLOPT_ENCODING => "", | |
CURLOPT_AUTOREFERER => true, | |
CURLOPT_CONNECTTIMEOUT => 7, | |
CURLOPT_TIMEOUT => 7, | |
CURLOPT_MAXREDIRS => 3, | |
CURLOPT_SSL_VERIFYHOST => false, | |
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13" | |
); | |
curl_setopt_array($ch, $curl_options); | |
$curlcontent = curl_exec( $ch ); | |
curl_close( $ch ); | |
} | |
""" | |
'Print R' : | |
'prefix' : 'print_r' | |
'body' : 'echo "<pre style=background:black;color:white>".print_r($1,true)."</pre>";' | |
'Needle Haystack' : | |
'prefix' : 'strpos' | |
'body' : """ | |
// if (strpos($haystack, $need) !== false) { | |
// if (preg_match("/needle/",$haystack)) | |
// if (strstr()) | |
""" | |
'Featured Image' : | |
'prefix' : 'ftr' | |
'body' : '$1 = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID()), "$2" );' | |
'Admin Notice' : | |
'prefix' : 'notice' | |
'body' : """ | |
add_action("admin_notices", function () { | |
?> | |
<div class="notice notice-info is-dismissible"> | |
<p>👋</p> | |
</div> | |
<? | |
}); | |
""" | |
'IP RESTRICT' : | |
'prefix' : 'me' | |
'body' : 'if ($_SERVER["REMOTE_ADDR"] != "") die;' | |
'Gravity Form' : | |
'prefix' : 'gform' | |
'body' : """ | |
// gravity_form($id, $dtitle=true,$ddescription=true, $inactive=false,$fvalues=null, $ajax=false, $tabindex); | |
// $form = RGForms::get_form($id); | |
""" | |
'Wordpress Loop' : | |
'prefix' : 'loop' | |
'body' : """ | |
if (have_posts()) : | |
while (have_posts()) : the_post(); | |
//do stuff.. | |
endwhile; | |
endif; | |
""" | |
'Transients' : | |
'prefix' : 'trans' | |
'body' : """ | |
if ( false === ( $value = get_transient( "something" ) ) ) { | |
$value = "foobar"; | |
set_transient( "something", $value, 24*60*24*7 ); | |
} | |
""" | |
'WP - Number of posts' : | |
'prefix' : 'num' | |
'body' : '// numberposts' | |
'WP - get_options' : | |
'prefix' : 'options' | |
'body' : """ | |
// admin_email | |
// blogname | |
// blogdescription | |
// blog_charset | |
// date_format | |
// default_category | |
// home | |
// url || wpurl | |
// template | |
// upload_path | |
// posts_per_page | |
""" | |
'WP - Hooks' : | |
'prefix' : 'hooks' | |
'body' : """ | |
// muplugins_loaded | |
// registered_taxonomy | |
// registered_taxonomy | |
// registered_taxonomy | |
// registered_taxonomy | |
// registered_taxonomy | |
// registered_post_type | |
// registered_post_type | |
// registered_post_type | |
// registered_post_type | |
// registered_post_type | |
// plugins_loaded | |
// sanitize_comment_cookies | |
// setup_theme | |
// unload_textdomain | |
// load_textdomain | |
// after_setup_theme | |
// load_textdomain | |
// load_textdomain | |
// auth_cookie_malformed | |
// auth_cookie_valid | |
// set_current_user | |
// init | |
// registered_post_type | |
// registered_post_type | |
// registered_post_type | |
// registered_post_type | |
// registered_post_type | |
// registered_taxonomy | |
// registered_taxonomy | |
// registered_taxonomy | |
// registered_taxonomy | |
// registered_taxonomy | |
// widgets_init | |
// register_sidebar | |
// register_sidebar | |
// register_sidebar | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_register_sidebar_widget | |
// wp_loaded | |
// parse_tax_query | |
// parse_tax_query | |
// posts_selection | |
// template_redirect | |
// admin_bar_init | |
// add_admin_bar_menus | |
// get_header | |
// wp_head | |
// wp_enqueue_scripts | |
// wp_print_styles | |
// wp_print_scripts | |
// get_template_part_content | |
// begin_fetch_post_thumbnail_html | |
// end_fetch_post_thumbnail_html | |
// get_template_part_content | |
// get_template_part_content | |
// get_template_part_content | |
// get_template_part_content | |
// get_template_part_content | |
// get_template_part_content | |
// get_template_part_content | |
// get_template_part_content | |
// get_template_part_content | |
// begin_fetch_post_thumbnail_html | |
// end_fetch_post_thumbnail_html | |
// get_sidebar | |
// dynamic_sidebar_before | |
// dynamic_sidebar | |
// dynamic_sidebar_after | |
// get_footer | |
// twentytwelve_credits | |
// wp_footer | |
// wp_print_footer_scripts | |
// wp_before_admin_bar_render | |
// wp_after_admin_bar_render | |
// shutdown | |
""" | |
'Server' : | |
'prefix' : 'server' | |
'body' : """ | |
/* Array ( | |
[SERVER_SOFTWARE] => Apache/2.0.63 (Unix) PHP/5.2.11 DAV/2 | |
[REQUEST_URI] => /wtv/wp-admin/plugins.php | |
[REDIRECT_STATUS] => 200 | |
[HTTP_HOST] => localhost | |
[HTTP_CONNECTION] => keep-alive | |
[HTTP_CACHE_CONTROL] => max-age=0 | |
[HTTP_USER_AGENT] => Mozilla/5.AppleWebKit/ Chrome/10.0.648.205 Safari/534.16 | |
[HTTP_ACCEPT] => application/xml,appli/png,*/*;q=0.5 | |
[HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch | |
[HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8 | |
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.3 | |
[HTTP_COOKIE] => wordpress....m=5aaf6d-12f8932aef8-26807dc0-950 | |
[HTTP_IF_MODIFIED_SINCE] => Mon, 25 Apr 2011 22:43:28 GMT | |
[PATH] => /usr/bin:/bin:/usr/sbin:/sbin | |
[SERVER_SIGNATURE] => Apache/2.0.63 (Unix) PHP/5.2.11 at localhost.davidsword Port 80 | |
[SERVER_NAME] => localhost.davidsword | |
[SERVER_ADDR] => 127.0.0.1 | |
[SERVER_PORT] => 80 | |
[REMOTE_ADDR] => 127.3.2.1 🔥 | |
[DOCUMENT_ROOT] => /Users/davidsword/wtv | |
[SERVER_ADMIN] => you@example.com | |
[SCRIPT_FILENAME] => /Users/davidsword/wtv/wp-admin/plugins.php | |
[REMOTE_PORT] => 61032 | |
[REDIRECT_URL] => /wtv/wp-admin/plugins.php | |
[GATEWAY_INTERFACE] => CGI/1.1 | |
[SERVER_PROTOCOL] => HTTP/1.1 | |
[REQUEST_METHOD] => GET | |
[QUERY_STRING] => | |
[SCRIPT_NAME] => /ds.me/wp-admin/plugins.php | |
[PHP_SELF] => /ds.me/wp-admin/plugins.php | |
[REQUEST_TIME] => 1303771464 | |
[argv] => Array ( ) | |
[argc] => 0 | |
)*/ | |
""" | |
'Date' : | |
'prefix' : 'date' | |
'body' : """ | |
// l, F jS, Y Friday March 21st, 2013 | |
// M j, y Mar 21, 13 | |
// Y-m-d H:i:s 2013-03-21 12:00:01 | |
// -Day | |
// j 1 to 31 | |
// d 01 to 31 | |
// D Mon - Sun | |
// l Sunday - Saturday | |
// S st, nd, rd, th | |
// -Month | |
// n 1 - 12 | |
// m 01 - 12 | |
// M Jan - Dec | |
// F January - December | |
// -Year | |
// y 99 | |
// Y 1999 | |
// -Time | |
// a am, pm | |
// A AM, PM | |
// -Hour | |
// g 1 - 12 | |
// G 0 - 23 | |
// h 01 - 12 | |
// H 00 - 23 | |
// -Min | |
// i 00 to 59 | |
// -Second | |
// s 00 - 59 | |
// -Time Zone | |
// O +0200 | |
// P +02:00 | |
// T EST, MDT | |
""" | |
# HTML ---------------------------------------------------------- | |
'.source.html, .source.php' : | |
'Meta Refresh' : | |
'prefix' : 'metarefresh' | |
'body' : '<meta http-equiv="refresh" content="1; url=http://example.com/">' | |
'HTML' : | |
'prefix' : 'html' | |
'body' : """ | |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="description" content=""> | |
<!-- Responsive Support --> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="style.css"> | |
<script src="https://code.jquery.com/jquery-latest.js"></script> | |
<script> | |
$(document).ready(function() { | |
}); | |
</script> | |
</head> | |
<body> | |
<header> | |
</header> | |
<main> | |
<section></section> | |
</main> | |
</body> | |
</html> | |
""" | |
'Blinker' : | |
'prefix' : 'blink' | |
'body' : """ | |
<style> | |
.blink { animation: blinker 2s ease infinite; } | |
@keyframes blinker { | |
50% { opacity: 0; } | |
} | |
</style> | |
<div class="blink"> | |
Blink180+2 | |
</div> | |
""" | |
'jQuery' : | |
'prefix' : 'jquery' | |
'body' : """ | |
<script src='//code.jquery.com/jquery-latest.js'></script> | |
<script> | |
// executes when HTML-Document is loaded and DOM is ready | |
// $(document).ready(function() { | |
// console.log('🍺 Ready'); | |
// }); | |
// executes when everything loaded (images, frames, etc) | |
$(window).load(function() { | |
console.log('🍺 Locked and Loaded'); | |
}); | |
</script> | |
""" | |
'blokk' : | |
'prefix' : 'blokk' | |
'body' : """ | |
<style> | |
*, html, html body, html body *, p, li, em, dl, dd, pre, span { font-family: "BLOKK", "BLOKK Neue" !important; } | |
</style> | |
<link href="//blokkfont-losgordos.netdna-ssl.com/v2/blokkfont.css" rel="stylesheet" type="text/css"> | |
""" | |
# CSS ---------------------------------------------------------- | |
'.source.css, .source.less, .source.sass, .source.scss' : | |
'LESS AutoCompile via Atom' : | |
'prefix' : 'less' | |
'body' : '// out: ../styles.css, compress: true \n//via : https://github.com/Azakur4/less-compiler' | |
'Input Placeholders' : | |
'prefix' : 'placeholders' | |
'body' : """ | |
::-webkit-input-placeholder { color: #809c39; } | |
:-moz-placeholder { color: #809c39; } | |
::-moz-placeholder { color: #809c39; } | |
:-ms-input-placeholder { color: #809c39; } | |
// -- OR --- | |
input[placeholder], [placeholder], *[placeholder] {' | |
""" | |
'Font Families' : | |
'prefix' : 'fontf' | |
'body' : """ | |
// font-family: Georgia, 'Times New Roman', serif; | |
// font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
// font-family: "Courier New", Courier, monospace;' | |
""" | |
'Centering' : | |
'prefix' : 'centering' | |
'body' : """ | |
// display: flex; | |
// align-items: center; | |
// justify-content: center; | |
// flex-direction: column; | |
// flex-wrap: wrap; | |
// or | |
// display: grid; | |
// future david: is there more? | |
""" | |
'Responsive Viewport' : | |
'prefix' : 'media' | |
'body' : '@media screen and (max-width: $1px) { }' | |
'Responsive Viewport' : | |
'prefix' : 'mobile' | |
'body' : '@media screen and (max-width: $1px) { }' | |
'transition' : | |
'prefix' : 'trans' | |
'body' : ' transition: 0.5s all ease;' | |
'highdpi' : | |
'prefix' : 'hidpi' | |
'body' : '@media (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) { }' | |
'PSEDUE BEFORE' : | |
'prefix' : 'before' | |
'body' : """ | |
content: ""; | |
display: block; | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
left:0; | |
top:0; | |
background: rgba(0,0,0,0.5); | |
z-index:1; | |
""" | |
# JS ---------------------------------------------------------- | |
'.source.js, .source.jsx' : | |
'JS - Console Log' : | |
'prefix' : 'c' | |
'body' : 'console.log($1);' | |
'JS - jQuery Selector' : | |
'prefix' : 'selector' | |
'body' : 'const $1 = document.querySelectorAll("$2")' | |
'JS - Debounce' : | |
'prefix' : 'debounce' | |
'body' : """ | |
function debounce(func, wait = 20, immediate = true) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) func.apply(context, args); | |
}; | |
var callNow = immediate && !timeout; | |
clearTimeout(timeout); | |
timeout = setTimeout(later, wait); | |
if (callNow) func.apply(context, args); | |
}; | |
} | |
""" | |
'JS - Resize' : | |
'prefix' : 'resize' | |
'body' : """ | |
function _resize() { } | |
// wait for window resizing to finish, then resize banner | |
jQuery(window).bind("resizeEnd", function() { | |
_resize(); | |
}); | |
jQuery(window).resize(function() { | |
if(this.resizeTO) clearTimeout(this.resizeTO); | |
this.resizeTO = setTimeout(function() { | |
_resize(); | |
}, 500); | |
}); | |
// fire on load, and again for insurance | |
_resize(); | |
setTimeout(_resize, 2000); | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment