Skip to content

Instantly share code, notes, and snippets.

Zachary Wills zachwills

View GitHub Profile
@zachwills
zachwills / wptouch-add-cookie-to-request.php
Last active Apr 17, 2017
Small mu-plugin that adds a cookie to requests when the mobile theme is being shown. Used for caching scenarios.
View wptouch-add-cookie-to-request.php
@zachwills
zachwills / clean-html-for-xml.php
Created Aug 12, 2015
Clean UTF8 WordPress HTML string for XML use.
View clean-html-for-xml.php
/**
* 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 / fieldmanager.php
Last active Aug 29, 2015
Fieldmanager autocomplete w/ datasource
View fieldmanager.php
$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 / get_tokens.js
Created Jan 27, 2015
Get array of values within brackets
View get_tokens.js
/**
* Get Tokens
* function for extracting tokens
*/
function get_tokens( str ) {
var results = [],
re = /{{([^}]+)}}/g,
text;
while( text = re.exec( str ) ) {
@zachwills
zachwills / _breakpoint.scss
Created Dec 19, 2014
SCSS Breakpoint mixin
View _breakpoint.scss
/* ==========================================================================
Media Query Mixins
========================================================================== */
/* Custom Breakpoints collection
========================================================================== */
$breakpoints: (xs, sm, md, lg);
View _hover.scss
/* ==========================================================================
Hover Mixin
========================================================================== */
/**
* Hover & active!
*/
@mixin hover() {
&:hover, &:active, &:focus {
@content;
@zachwills
zachwills / _spacing.scss
Created Dec 19, 2014
SCSS Spacing (padding / margin) mixin
View _spacing.scss
/* ==========================================================================
Spacing Mixins
========================================================================== */
/**
* Define these spacing variables
*/
$spacing-base: 28px;
$spacing-double: $spacing-base*2;
$spacing-triple: $spacing-base*3;
You can’t perform that action at this time.