Skip to content

Instantly share code, notes, and snippets.

View zachwills's full-sized avatar
❤️

Zachary Wills zachwills

❤️
View GitHub Profile
@zachwills
zachwills / _spacing.scss
Created December 19, 2014 14:05
SCSS Spacing (padding / margin) mixin
/* ==========================================================================
Spacing Mixins
========================================================================== */
/**
* Define these spacing variables
*/
$spacing-base: 28px;
$spacing-double: $spacing-base*2;
$spacing-triple: $spacing-base*3;
@zachwills
zachwills / _hover.scss
Created December 19, 2014 14:06
Hover mixin
/* ==========================================================================
Hover Mixin
========================================================================== */
/**
* Hover & active!
*/
@mixin hover() {
&:hover, &:active, &:focus {
@content;
@zachwills
zachwills / _breakpoint.scss
Created December 19, 2014 14:08
SCSS Breakpoint mixin
/* ==========================================================================
Media Query Mixins
========================================================================== */
/* Custom Breakpoints collection
========================================================================== */
$breakpoints: (xs, sm, md, lg);
@zachwills
zachwills / get_tokens.js
Created January 27, 2015 19:20
Get array of values within brackets
/**
* Get Tokens
* function for extracting tokens
*/
function get_tokens( str ) {
var results = [],
re = /{{([^}]+)}}/g,
text;
while( text = re.exec( str ) ) {
@zachwills
zachwills / fieldmanager.php
Last active August 29, 2015 14:17
Fieldmanager autocomplete w/ datasource
$datasource_speakers = new Fieldmanager_Datasource_Post( array(
'query_args' => array( 'post_type' => array( 'speaker' ) ),
'use_ajax' => true
) );
$fm = new Fieldmanager_Autocomplete( __( 'Speaker' ), array(
'name' => 'speakers',
'datasource' => $datasource_speakers,
'sortable' => true,
'limit' => 0,
@zachwills
zachwills / clean-html-for-xml.php
Created August 12, 2015 22:24
Clean UTF8 WordPress HTML string for XML use.
/**
* Clean utf8 HTML string for XML.
*
*
* @param string $string HTML string you want to make XML safe.
*/
function clean_html_for_xml( $string ) {
$string = strip_tags( $string );
$string = htmlspecialchars( $string );
$string = strip_shortcodes( $string );
@zachwills
zachwills / wptouch-add-cookie-to-request.php
Last active April 17, 2017 12:48
Small mu-plugin that adds a cookie to requests when the mobile theme is being shown. Used for caching scenarios.