Skip to content

Instantly share code, notes, and snippets.


Heath Dutton ☕ heathdutton

Block or report user

Report or block heathdutton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
heathdutton / pagespeed-fix.js
Last active Aug 29, 2015
Simple resolution for when Google Pagespeed sharding is failing for some customers due to local DNS issues.
View pagespeed-fix.js
* Fallback for Google Pagespeed sharding.
* Presumptions:
* Pagespeed sharding is on.
* This javascript is included at the bottom of the body (or there-abouts).
* The website in question includes jQuery on this page.
* Pagespeed is sharding the jQuery javascript (it isn't being loaded externally).
* If the user cannot get one of the shard subdomains, they cannot get them all.
heathdutton / gist:943b59be9f3844a202c6
Last active Aug 29, 2015
Limit schools based on a state field in Hubspot.
View gist:943b59be9f3844a202c6
if (typeof jQuery == 'undefined'){
console.log('Filterizer: Cannot be ran. jQuery is not loaded yet.');
} else {
(function($) {
var attempt_time = 10, // amount of time to keep trying in seconds
interval_ms = 150, // how frequently to attempt in ms
elapsed_time = 0, // elapsed time in ms
interval = setInterval(function(){
elapsed_time += interval_ms;
heathdutton / gist:67148cddf2af3c56216d
Created Jun 18, 2015
jQuery 1.7.1 with two addressfields
View gist:67148cddf2af3c56216d
Uncaught TypeError: Cannot read property 'fields' of undefined
(anonymous function)
(anonymous function)
heathdutton / outbound_links.js
Last active Sep 9, 2015
Catch outbound links in Google Analytics
View outbound_links.js
View gist:1154555
// ...[curl code]...
$info = curl_getinfo($ch);
$header = substr($response, 0, $info['header_size']);
$body = substr($response, -$info['download_content_length']);
heathdutton / gist:1189422
Created Sep 2, 2011
basic json/jsonp api output
View gist:1189422
$data = array(1, 2, 3, 4, 5, 6, 7, 8, 9);
// assume by this point we are needing to respond by JSON or JSONP. $data can be an object or array :D
header('content-type: application/json; charset=utf-8');
if (isset($_GET['callback']) && ctype_alnum($_GET['callback'])){
// JSONP response
} else {
heathdutton / gist:1540656
Created Dec 30, 2011
the offending script
View gist:1540656
(function (window, document) {
var doc = document;
document._write = document.write;
var _tcproto = (window.location.protocol == "https:") ? "https" : "http";
var _tchost = _tcproto + "://";
var _log_request = 0;
if (getQueryParam("tclogging") == 1) {
_log_request = 1
var _args = {};
heathdutton / gist:3659298
Created Sep 6, 2012
The working, somehow magical combination.
View gist:3659298
drush dis htmlmail -y
drush en update -y
drush updb -y
drush dis update -y
drush en htmlmail -y
drush updb -y
heathdutton / gist:4149003
Created Nov 26, 2012
Magento Custom - Get a list of customers/contracts that are affected by forceful product deletion
View gist:4149003
enterprise_giftregistry_entity.tui_holiday_contract_id as Contract,
enterprise_giftregistry_entity.tui_holiday_departure_date as Departure
# Only do this for holidays that have not yet departed
heathdutton / gist:4150493
Created Nov 26, 2012
Magento Custom - Migrate Gift Registry products from deleted duplicate products to the desired product IDs.
View gist:4150493
DROP PROCEDURE IF EXISTS MigrateDeletedProduct//
CREATE PROCEDURE MigrateDeletedProduct(
IN source_product_id INT,
IN dest_product_id INT)
# Define the destination product ID:
You can’t perform that action at this time.