Skip to content

Instantly share code, notes, and snippets.

Chris Jamieson jamiesoncj

Block or report user

Report or block jamiesoncj

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
jamiesoncj / Simple Equal Heights
Created Apr 28, 2013
Simple JavaScript / jQuery code to set equal heights to elements. Original snippet from Paul Irish
View Simple Equal Heights
/* equal heights */
$.fn.setAllToMaxHeight = function(){
return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
$(window).load(function() {
$('#elementID, .elementClass').setAllToMaxHeight();
jamiesoncj / Set image title attribute as caption
Last active Dec 25, 2016
Simple jQuery snippet to set the title attribute of an <img> as a caption
View Set image title attribute as caption
$(document).ready(function() {
$("img").each(function () {
var $this = $(this);
var title = $this.attr("title");
$this.after('<div class="caption">'+ title +'</div>');
jamiesoncj / Validate URL
Created Apr 30, 2013
Simple PHP snippet to validate a URL using preg_match
View Validate URL
function isValidURL($url){
return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);
// usage
$message = 'Please enter a valid URL';
echo $message;
jamiesoncj /
Last active Apr 29, 2019
Install Epson AL-M1200 printer on Ubuntu

Ubuntu seems to have trouble talking to the Epson AL-M1200 printer. These instructions will get it working. Based on a set of instructions found here.

  1. Download epsoneplijs-0.4.1.tgz -file from here
  2. cd Downloads (or whatever directory you downloaded the file to)
  3. tar zxvf epsoneplijs-0.4.1.tgz
  4. cd epsoneplijs-0.4.1
  5. ./configure --prefix=/usr
  6. sudo make install
  7. Download PPD file from here or here
  8. Connect your printer to your computer and turn it on. (You can do it in the beginning, but at least now you need it connected and powered on.)
jamiesoncj / gist:9251276
Created Feb 27, 2014
Record a GIF screencast with Byzanz
View gist:9251276
byzanz-record --duration=20 --delay=5 x=0 --y=0 --width=1024 --height=800 output.gif
jamiesoncj / gist:391fac04e764d6710292
Created Jun 12, 2014
Drupal display errors (add to index.php)
View gist:391fac04e764d6710292
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
jamiesoncj / gist:f762dd9c82e00699bb43
Created Jun 15, 2014
Drupal commerce hide billing address fields when giftcard added to make order free
View gist:f762dd9c82e00699bb43
* function to remove billing fields from display if giftcard / coupon makes order total £0.00
// on change due to ajax
$( document ).ajaxComplete(function() {
console.log( "Triggered ajaxComplete handler." );
var orderTotal = $('.page-checkout .view-id-commerce_cart_summary .field-name-commerce-order-total .component-type-commerce-price-formatted-amount .component-total').text();
if(orderTotal == '£0.00'){
console.log('Order total is zero (var: ' + orderTotal + ')');
jamiesoncj /
Last active Aug 29, 2015
Custom video helper - hide the "Upload" option for media module
name = Custom video helper
description = Provides some custom hooks that help video uploads
core = 7.x
package = Media
jamiesoncj / gist:e10676442c9a0aae09ec
Created Aug 12, 2014
Disable pingbacks for Wordpress (SQL query)
View gist:e10676442c9a0aae09ec
UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'post';
UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'page';
You can’t perform that action at this time.