Skip to content

Instantly share code, notes, and snippets.

View heathdutton's full-sized avatar
🕴️
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈

Heath Dutton ☕ heathdutton

🕴️
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈
  • ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  • Tampa Florida
  • https://orcid.org/0009-0005-9397-422X
View GitHub Profile
@heathdutton
heathdutton / pagespeed-fix.js
Last active August 29, 2015 14:06
Simple resolution for when Google Pagespeed sharding is failing for some customers due to local DNS issues.
/*
* 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
heathdutton / gist:943b59be9f3844a202c6
Last active August 29, 2015 14:07
Limit schools based on a state field in Hubspot.
if (typeof jQuery == 'undefined'){
console.log('Filterizer: Cannot be ran. jQuery is not loaded yet.');
} else {
(function($) {
$(document).ready(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
heathdutton / gist:67148cddf2af3c56216d
Created June 18, 2015 22:23
jQuery 1.7.1 with two addressfields
Uncaught TypeError: Cannot read property 'fields' of undefined
$.fn.addressfield.apply
(anonymous function)
f.event.dispatch
f.event.add.h.handle.i
f.event.trigger
(anonymous function)
e.extend.each
e.fn.e.each
f.fn.extend.trigger
@heathdutton
heathdutton / outbound_links.js
Last active September 9, 2015 15:11
Catch outbound links in Google Analytics
// ...[curl code]...
$info = curl_getinfo($ch);
curl_close($ch);
$header = substr($response, 0, $info['header_size']);
$body = substr($response, -$info['download_content_length']);
@heathdutton
heathdutton / gist:1189422
Created September 2, 2011 18:33
basic json/jsonp api output
<?php
$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
exit($_GET['callback'].'('.json_encode($data).')');
} else {
@heathdutton
heathdutton / gist:1540656
Created December 30, 2011 17:17
the offending script
(function (window, document) {
var doc = document;
document._write = document.write;
var _tcproto = (window.location.protocol == "https:") ? "https" : "http";
var _tchost = _tcproto + "://tc.convertro.com/tagroot";
var _log_request = 0;
if (getQueryParam("tclogging") == 1) {
_log_request = 1
}
var _args = {};
@heathdutton
heathdutton / gist:3659298
Created September 6, 2012 18:37
The working, somehow magical combination.
drush dis htmlmail -y
drush en update -y
drush updb -y
drush dis update -y
drush en htmlmail -y
drush updb -y
@heathdutton
heathdutton / gist:4149003
Created November 26, 2012 16:08
Magento Custom - Get a list of customers/contracts that are affected by forceful product deletion
SELECT DISTINCT
customer_entity.email as Email,
enterprise_giftregistry_entity.tui_holiday_contract_id as Contract,
enterprise_giftregistry_entity.tui_holiday_departure_date as Departure
FROM
enterprise_giftregistry_item,
enterprise_giftregistry_entity,
customer_entity
WHERE
# Only do this for holidays that have not yet departed
@heathdutton
heathdutton / gist:4150493
Created November 26, 2012 20:42
Magento Custom - Migrate Gift Registry products from deleted duplicate products to the desired product IDs.
DELIMITER //
DROP PROCEDURE IF EXISTS MigrateDeletedProduct//
CREATE PROCEDURE MigrateDeletedProduct(
IN source_product_id INT,
IN dest_product_id INT)
BEGIN
UPDATE
enterprise_giftregistry_item
SET
# Define the destination product ID: