Skip to content

Instantly share code, notes, and snippets.

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

Heath Dutton ☕ heathdutton

🕴️
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈 oh hello
  • ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  • Tampa Florida
  • 18:56 (UTC -05:00)
  • https://orcid.org/0009-0005-9397-422X
View GitHub Profile
// ...[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:
@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