Discover gists
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
<?php | |
$SITEPATH = $_SERVER['DOCUMENT_ROOT'] . '/path/to/dir/'; | |
function get_uri( $image, $mime = '' ) { | |
return 'data: ' . $mime . ';base64,'.base64_encode(file_get_contents( $image )); | |
} | |
?> |
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
<?php | |
// REF: http://stackoverflow.com/questions/14780804/how-do-i-read-a-google-drive-spreadsheet-in-php | |
$spreadsheet_url="https://docs.google.com/spreadsheets/d/1MLAko1Eym5O-Qt7cRQb55RBWH3ZHW2_VmHCV0x1Bx5s/pub?gid=0&single=true&output=csv"; | |
$stack = array(); | |
if(!ini_set('default_socket_timeout', 15)) echo "<!-- unable to change socket timeout -->"; |
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
UPDATE wp_posts SET guid=replace(guid, 'http://old.url', 'http://new.url'); | |
UPDATE wp_posts SET post_content=replace(post_content, 'http://old.url', 'http://new.url'); |
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
/* | |
// Source: https://madebymike.com.au//writing/service-workers/ | |
<script> | |
if ( 'serviceWorker' in navigator && ( typeof Cache !== 'undefined' && Cache.prototype.addAll ) ) { | |
navigator.serviceWorker.register( '/sw.js' ); | |
} | |
</script> | |
*/ |
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
Modal: http://www.humaan.com/modaal/ | |
Tabs: http://www.scottohara.me/tabs/ | |
Accordion: https://github.com/nico3333fr/jquery-accessible-accordion-aria | |
Slider: http://kenwheeler.github.io/slick/ | |
Tooltips: https://github.com/scottaohara/a11y_tooltips |
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
/** | |
* Create svg images | |
* | |
* @param string $name Icon name. | |
* @param array $opts Optional attributes. | |
* | |
* @return string | |
*/ | |
function svg_icon( $name, $opts = array() ) { |
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
/** @function | |
* @name debounce | |
* @description Utility method for debouncing the resize event | |
* @param {function} func | |
* @param {number} wait | |
* @param {object} immediate | |
* @example var myEfficientFn = debounce(function() { things to do }, 250); | |
* @example window.addEventListener( 'resize', myEfficientFn ); | |
*/ |
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
/** | |
* @file A simple Ajax call that will work down to IE10 | |
* @author Tim Wright | |
* @license MIT | |
* @example ajaxCall({ 'url' : 'http://...', 'type' : 'GET', 'data' : 'json' }, function( data ){ /callback function here/ }); | |
*/ | |
( function ( global ) { | |
'use strict'; |
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
/** | |
* Get URL params | |
* | |
* @param {String} query - The location.search query | |
* @returns {Object} - the params | |
*/ | |
export const getUrlParams = ( query ) => { | |
const vars = query.split( '&' ); | |
const queryString = {}; |
NewerOlder