Skip to content

Instantly share code, notes, and snippets.

@carrieforde
Created November 21, 2016 18:06
Show Gist options
  • Save carrieforde/ac56725446cd3c1d2b9b7de2d52e9650 to your computer and use it in GitHub Desktop.
Save carrieforde/ac56725446cd3c1d2b9b7de2d52e9650 to your computer and use it in GitHub Desktop.
Helpful Snippets for WordPress development in Brackets
- trigger: wdsjs
description: jQuery - The WDS Way
scope: javascript
mTime: 1473172253165
text: |
/**
* ${1:Foo Script}.
*/
window.${2:Foo_Object} = {};
( function( window, $, app ) {
\t// Private variable.
\tvar ${3:fooVariable} = '${4:varName}';
\t// Constructor.
\tapp.init = function() {
\t\tapp.cache();
\t\tif ( app.meetsRequirements() ) {
\t\t\tapp.bindEvents();
\t\t}
\t};
\t// Cache elements.
\tapp.cache = function() {
\t\tapp.$c = {
\t\t\twindow: $( window ),
\t\t\t${5:fooSelector}: $( '${6:.foo}' ),
\t\t};
\t};
\t// Combine all events.
\tapp.bindEvents = function() {
\t\tapp.$c.window.on( 'load', app.doFoo );
\t};
\t// Do we meet the requirements?
\tapp.meetsRequirements = function() {
\t\treturn app.$c.${5}.length;
\t};
\t/**
\t * Do Foo.
\t *
\t * @return
\t * @author Your Name
\t */
\tapp.doFoo = function() {
\t\t// do stuff
\t};
\t// Engage!
\t$( app.init );
})( window, jQuery, window.${2} );
- trigger: scss
description: SCSS Doc Block
scope: scss
mTime: 1470070833955
text: |
//--------------------------------------------------------------
// ${1:COMMENT}
//--------------------------------------------------------------
- trigger: media
description: "Neat Media Query @include"
scope: scss
mTime: 1479148522532
text: |
@include media(${1:media-query}) {
${2}
}
- trigger: tp
description: $tablet-portrait
scope: scss
mTime: 1470073767071
text: $tablet-portrait
- trigger: tl
description: $tablet-landscape
scope: scss
mTime: 1470340255343
text: $tablet-landscape
- trigger: size
description: Neat size()
scope: scss
mTime: 1472770144856
text: |
@include size(${1});
- trigger: pos
description: "@include position"
scope: scss
mTime: 1472770546813
text: |
@include position(${1:position}, ${2} ${3} ${4} ${5});
- trigger: selector
description: CSS selector
scope: scss
mTime: 1473258421798
text: |
${1:selector} {
${2:properties}
} // ${1}
- trigger: smscss
description: Smaller SCSS comments
scope: scss
mTime: 1473695892356
text: |
//-----------------------------------------
// ${1:Section Name}
//-----------------------------------------
- trigger: shortcake
description: Setup Shortcake callback
scope: php
mTime: 1472959787176
text: |
if ( ! function_exists( 'shortcode_ui_register_for_shortcode' ) ) {
return;
}
shortcode_ui_register_for_shortcode(
'${1:shortcode name}',
array(
'label' => esc_html__( '${2:Shortcode Nice Name}', '${3:text-domain}' ),
'attrs' => array(
${4:attrs}
),
)
);
- trigger: scattrs
description: Shortcake Attrs
scope: php
mTime: 1473017942193
text: |
array(
'label' => esc_html__( '${1:attr name}', '${2:text domain}' ),
'description' => esc_html__( '${3:attr description}', '${2}' ),
'attr' => '${4:attr key}',
'type' => '${5:attr type}',
),
${6}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment