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 / gist:b2ce50331cef3aee969b
Created Sep 24, 2014
Chaplaincy events helper JS walkthrough for Adam
View gist:b2ce50331cef3aee969b
/* campus events (this is custom.js line 71) */
// first, select each views row on the campus events products view (first view as per email)
$(".view-id-campus_events.view-display-id-page .views-row, .view-id-campus_events_products.view-display-id-page .views-row").each(function(index) {
// examine the current URL.get the page id we are currently on (from the URL). Get only the query parameters (the bits after the "q" in the URL) - NB this means the function will fail if Drupal clean URLs is enabled.
var pathname =;
// using the query parameters, get the page number by getting the value of the "page" parameter
var pageNumber = pathname.split('page=')[1];
// if we haven't found anything, this is the first page (but it's zero-indexed, so it's page 0)
jamiesoncj / U.S. and Europe
Last active Aug 29, 2015
ISO Currency Codes allowed by Stripe
View U.S. and Europe
stripeAllowedCurrencies = ["aed", "afn", "all", "amd", "ang", "aoa", "ars", "aud", "awg", "azn", "bam", "bbd", "bdt", "bgn", "bif", "bmd", "bnd", "bob", "brl", "bsd", "bwp", "bzd", "cad", "cdf", "chf", "clp", "cny", "cop", "crc", "cve", "czk", "djf", "dkk", "dop", "dzd", "eek", "egp", "etb", "eur", "fjd", "fkp", "gbp", "gel", "gip", "gmd", "gnf", "gtq", "gyd", "hkd", "hnl", "hrk", "htg", "huf", "idr", "ils", "inr", "isk", "jmd", "jpy", "kes", "kgs", "khr", "kmf", "krw", "kyd", "kzt", "lak", "lbp", "lkr", "lrd", "lsl", "ltl", "lvl", "mad", "mdl", "mga", "mkd", "mnt", "mop", "mro", "mur", "mvr", "mwk", "mxn", "myr", "mzn", "nad", "ngn", "nio", "nok", "npr", "nzd", "pab", "pen", "pgk", "php", "pkr", "pln", "pyg", "qar", "ron", "rsd", "rub", "rwf", "sar", "sbd", "scr", "sek", "sgd", "shp", "sll", "sos", "srd", "std", "szl", "thb", "tjs", "top", "try", "ttd", "twd", "tzs", "uah", "ugx", "usd", "uyu", "uzs", "vnd", "vuv", "wst", "xaf", "xcd", "xof", "xpf", "yer", "zar", "zmw"];
jamiesoncj / gist:c81443fcfbe19ea34630
Created Jan 23, 2015
GoCardless Incorrect token error
View gist:c81443fcfbe19ea34630
import gocardless
from api import settings
# set environment to sandbox
gocardless.environment = settings.GOCARDLESS_ENVIRONMENT
jamiesoncj / gist:dd6047be45bcaaccc718
Last active Aug 29, 2015
GoCardless bad request error
View gist:dd6047be45bcaaccc718
# when get_gc_partner_authorization_url() is called, returns a URL
# when that URL is visited in the browser, error occurs
# error is: "invalid client_id or redirect_uri for sandbox environment"
gocardless.environment = settings.GOCARDLESS_ENVIRONMENT
app_id=settings.GOCARDLESS_MERCHANT_APP_ID, # taken from
app_secret=settings.GOCARDLESS_MERCHANT_APP_SECRET, # taken from
access_token=settings.GOCARDLESS_MERCHANT_ACCESS_TOKEN, # taken from
View app.js
var $ = document.getElementById.bind(document);
var $$ = document.querySelectorAll.bind(document);
var App = function($el){
this.$el = $el;
jamiesoncj / gist:06e06dc16680fde2e8b3
Created Mar 24, 2015
Message thread query syntax mongolab
View gist:06e06dc16680fde2e8b3
"_id": {
"$oid": "5507785bd4a87b03003f5c5b"
jamiesoncj / gist:b0bded976eb8c60b44ea
Created Mar 24, 2015
Python convert from unicode
View gist:b0bded976eb8c60b44ea
# original from
def convert_from_unicode(input):
if isinstance(input, dict):
return dict((convert_from_unicode(key), convert_from_unicode(value)) for key, value in input.iteritems())
elif isinstance(input, list):
return [convert_from_unicode(element) for element in input]
elif isinstance(input, unicode):
return input.encode('utf-8')
return input
View gist:e326e73b2ee4a0f69f37
## Ubuntu
- Install from Live DVD
## Dev tools
- Sublime
- Git
- Heroku
- Meteor
jamiesoncj /
Created Oct 7, 2015
Segment available integrations

The following is a list of integrations available via Segment as at 7th Oct 2015

  • Facebook Conversions
  • Google Analytics
  • Google Tag Manager
  • GoSquared
  • Hello Bar
  • Intercom
  • Lucky Orange
  • MailChimp
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();
You can’t perform that action at this time.