Skip to content

Instantly share code, notes, and snippets.

View heathdutton's full-sized avatar
🕴️
Headlines are unsanitized input. Attention is prod.

Heath Dutton🕴️ heathdutton

🕴️
Headlines are unsanitized input. Attention is prod.
View GitHub Profile
@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:
@heathdutton
heathdutton / gist:4150767
Created November 26, 2012 21:34
Magento Custom - Delete instances of deleted product "Santa Margherita Prosecco" from pending holidays that have not yet been purchased.
DELETE FROM
enterprise_giftregistry_item
WHERE
enterprise_giftregistry_item.item_id IS IN (667, 31013, 33823, 35795, 35826);
@heathdutton
heathdutton / gist:4274386
Created December 13, 2012 05:55
List of all boats in Drupal SS as per TMW-679.
SELECT
core_fleet_boats.code as 'Boat Code',
core_fleet_boats.name as 'Boat Name',
core_bs_node_extras.search_description as 'Short Boat Description',
CONCAT('http://www.sunsail.co.uk/', (core_files.filepath)) as 'Layout Image URL', /* note, this is the original file, not web-optimized */
/* Get the first 4 images of this boat as columns */
CONCAT('http://www.sunsail.co.uk/', (SELECT core_files.filepath FROM
core_content_field_gallery,
core_files
WHERE
@heathdutton
heathdutton / gist:4288090
Created December 14, 2012 19:49
Find all instances of registry/holiday products that are missing from the website that they exist in.
/* Find all instances of registry/holiday products that are missing from the website that they exist in */
SELECT * FROM
enterprise_giftregistry_item,
enterprise_giftregistry_entity,
catalog_product_website
WHERE
enterprise_giftregistry_entity.entity_id = enterprise_giftregistry_item.entity_id AND /* get the registry entity */
enterprise_giftregistry_item.product_id = catalog_product_website.product_id AND /* get the product entity */
enterprise_giftregistry_entity.website_id NOT IN (
SELECT
@heathdutton
heathdutton / gist:5629473
Created May 22, 2013 17:50
A bookmarklet to expand a krumo dump. No libraries needed.
javascript:styles%3D%27div.krumo-nest %7Bdisplay: block !important%3B%7D%27%3B newSS %3D document.createElement(%27link%27)%3B newSS.rel %3D %27stylesheet%27%3B newSS.href %3D %27data:text/css,%27 %2B escape(styles)%3B document.documentElement.childNodes%5B0%5D.appendChild(newSS)%3B void 0
@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 / 50_purge_varnish.sh
Last active April 30, 2019 14:00
Acquia Cloud hook for flushing Varnish .com domains securely.
#!/bin/bash
#
# Cloud Hooks: code-deploy, code-update, db-copy, web-activate
# Essentially any time code or db changes are made.
#
# Purges Varnish cache for all .com domains assigned to the environment in Acquia Cloud.
site="$1"
target_env="$2"
drush_alias=$site'.'$target_env
@heathdutton
heathdutton / gist:cc29284de3934706acd1
Created April 26, 2015 03:19
Start an Acquia drush command, and wait for it to complete before continuing.
#!/bin/bash
# Runs an acquia task, and waits for the task to complete before continuing.
# This is a helper script, to be used in others as needed.
if [[ $1 = "" ]] || [[ $2 = "" ]]
then
echo "Runs an acquia drush command, waiting for the results before continuing."
echo "Can be used as a replacement for drush."
echo
echo " Usage: $0 <site-alias> <ac-drush-command>"