Skip to content

Instantly share code, notes, and snippets.

View grahamb's full-sized avatar
🇨🇦
As Canadian as possible under the circumstances

Graham Ballantyne grahamb

🇨🇦
As Canadian as possible under the circumstances
View GitHub Profile
// YQL SELECT Query:
// SELECT * FROM html WHERE url="http://www.conquercancer.ca/site/TR?px=1817895&fr_id=1331&pg=personal" AND xpath="//p[@class='Smaller']"
var yql = "http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20html%20WHERE%20url%3D%22http%3A%2F%2Fwww.conquercancer.ca%2Fsite%2FTR%3Fpx%3D1817895%26fr_id%3D1331%26pg%3Dpersonal%22%20AND%20xpath%3D%22%2F%2Fp%5B%40class%3D'Smaller'%5D%22&format=json&diagnostics=false&callback=?";
$.ajax({type:'GET', url: yql, dataType:'jsonp', success: function(data, textStatus) {
var amount = $.trim(data.query.results.p.content).substr(10),
dollarsign = amount.substr(0, 1),
cents = amount.substr((amount.length)-2),
dollars = amount.substr(1, amount.indexOf('.')-1),
@grahamb
grahamb / gist:283579
Created January 22, 2010 08:03
Redbox
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
p { margin: 0; padding: 0;}
#donations {
background-color: #b5111a;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(1, rgb(181,17,25)), color-stop(0.22, rgb(138,0,12)));
$('#mysfu_container').delegate('a[href^="mailto:"]', 'click', function(e) {
var href = $(this).attr('href').substr(7).split('?')
, to = href[0]
, params = href.length > 1 ? href[1].split('&') : null;
console.log(to, params);
e.preventDefault();
return false;
});
{
"checkedOut": [
{
"title": "...",
"author": "...",
"dueDate": "..."
},
{
"title": "...",
"author": "...",
@grahamb
grahamb / gist:1563696
Created January 5, 2012 04:21
Arduino output
# Here is the "preprocessing".
# It creates a .cpp file based with the same name as the .ino file.
# On top of the new .cpp file comes the WProgram.h header.
# and prototypes for setup() and Loop()
# Then the .cpp file will be compiled. Errors during compile will
# refer to this new, automatically generated, file.
# Not the original .ino file you actually edit...
test -d applet || mkdir applet
echo '#include "Arduino.h"' > applet/biebduino.cpp
echo 'void setup();' >> applet/biebduino.cpp
@grahamb
grahamb / adrian_dix
Created January 20, 2012 19:41
Letters in support of the Rio Theatre
Adrian Dix
Member of the Legislative Assembly, Vancouver-Kingsway
Room 201
Parliament Buildings
Victoria, BC
V8V 1X4
SUBMITTED BY EMAIL: adrian.dix.mla@leg.bc.ca
Dear Mr. Dix,
handlebars.registerHelper('helperMissing', function(token) {
return '{{'+token+'}}';
});
@grahamb
grahamb / git log
Created January 30, 2012 20:04
git log
git config --global format.pretty "%C(yellow)%h%Creset %s %C(blue)(%cr)%Creset"
@grahamb
grahamb / gist:1971719
Created March 4, 2012 09:45
Stock answer to "why doesn't sfu.ca work"
Yes, this problem is on our radar -- it's actually one of my pet peeves :-)
The problem with the resolution of "http://sfu.ca" links is related to a
very early installation of a domain server for Microsoft Active
Directory that was allocated the DNS entry "sfu.ca". This was prior to
the existence of sites like "slashdot.net" that were among the earliest
sites to forgo the "www." prefix. At the time (in the mid-1990s), all
services on the internet were typically prefixed with the protocol as
part of their name (eg. ftp.sfu.ca, www.sfu.ca, gopher.sfu.ca, etc.)
@grahamb
grahamb / dict.js
Created March 20, 2012 17:54 — forked from jnraine/dict.js
Y U SO VERBOSE JAVA?
{"foo": "bar", "baz": "quux"}