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
View gist:1154555
// ...[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 Sep 2, 2011
basic json/jsonp api output
View gist:1189422
<?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 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 + "://tc.convertro.com/tagroot";
var _log_request = 0;
if (getQueryParam("tclogging") == 1) {
_log_request = 1
}
var _args = {};
@heathdutton
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
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
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 Nov 26, 2012
Magento Custom - Migrate Gift Registry products from deleted duplicate products to the desired product IDs.
View gist:4150493
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 Nov 26, 2012
Magento Custom - Delete instances of deleted product "Santa Margherita Prosecco" from pending holidays that have not yet been purchased.
View gist:4150767
DELETE FROM
enterprise_giftregistry_item
WHERE
enterprise_giftregistry_item.item_id IS IN (667, 31013, 33823, 35795, 35826);
@heathdutton
heathdutton / gist:4274386
Created Dec 13, 2012
List of all boats in Drupal SS as per TMW-679.
View gist:4274386
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 Dec 14, 2012
Find all instances of registry/holiday products that are missing from the website that they exist in.
View gist:4288090
/* 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
A bookmarklet to expand a krumo dump. No libraries needed.
View gist:5629473
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
You can’t perform that action at this time.