Skip to content

Instantly share code, notes, and snippets.

View ianhampton's full-sized avatar

Ian Hampton ianhampton

  • Tealium
  • Oxford, UK
View GitHub Profile
// Configure new account/profile/environment details
var newAccount = "ianhampton";
var newProfile = "demo";
var newEnvironment = "prod";
try {
// Dynamically update environment
newEnvironment = document.querySelector('script[src*="tiqcdn.com"]').src.toString().split('/')[6];
} catch(e) {}
@ianhampton
ianhampton / contracthire.js
Last active July 2, 2018 10:28
Contract Hire and Leasing Calculator - Fixed
// ==UserScript==
// @name Contract Hire and Leasing Calculator
// @namespace http://rorymccrossan.co.uk
// @version 1.0
// @description Adds helpful information to each deal
// @author Rory McCrossan
// @match *://www.contracthireandleasing.com/personal/*
// @match *://www.contracthireandleasing.com/business/*
// @grant none
// ==/UserScript==
@ianhampton
ianhampton / always-open-wc.js
Last active June 19, 2017 14:42
Always open Web Companion if Tealium is running
// ==UserScript==
// @name Always open Web Companion
// @namespace http://tealium.com/
// @version 0.1
// @description Always open WC if Tealium is running
// @author Ian Hampton
// @match *://*/*
// @grant none
// ==/UserScript==
// ==UserScript==
// @name Fix Pistonheads Images
// @version 1.0
// @description Fixes insecure images on Pistonheads
// @match *://*.pistonheads.com/*
// @author Ian Hampton
// @copyright 2017
// ==/UserScript==
(function() {
@ianhampton
ianhampton / contact-form-7-dynamic-attachment.php
Last active November 7, 2024 22:12
Dynamically add file attachments to Contact Form 7 emails from a custom field
<?php
/* Dynamically add file attachments to Contact Form 7 emails from a Wordpress custom field.
* Custom field is 'case-pdf' in the example.
*/
add_action('wpcf7_before_send_mail', 'wpcf7_add_attachment');
function wpcf7_add_attachment($contact_form) {
global $_POST;
$submission = WPCF7_Submission::get_instance();