This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import ConfigParser | |
import os | |
import os.path as op | |
import gdata.photos.service | |
import gdata.media | |
import gdata.geo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, | |
TemplateHaskell, OverloadedStrings #-} | |
import Yesod | |
-- The app is parameterised on a custom datatype; this can also | |
-- contain other info of course: | |
data Links = Links | |
-- Routes, using template-haskell. (I find "Links" as a string to be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# See for eg | |
# http://stackoverflow.com/questions/4526910/rename-a-git-submodule; | |
# an important point seems to be to avoiding the trailing '/' when | |
# calling 'add' in the new location. | |
# Also, note that the name ([submodule = "name"]) in the .gitmodules | |
# file can be anything; it's just used to map to the corresponding | |
# .git/config entry. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $LL = (function($) { | |
var deferreds = {}; | |
return function(s, c) { | |
if (s in deferreds) { | |
deferreds[s].done(function(){ | |
c(); | |
}); | |
return; | |
} | |
deferreds[s] = $.Deferred(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clean up all those invasive and ugly utm_ parameters, so you can paste a url. | |
// (will reload the page, be warned) | |
(function(){ | |
var qs = window.location.search.slice(1).split('&'), | |
newqs = []; | |
for (var i = 0; i < qs.length; i++) { | |
if (qs[i].slice(0,4)!='utm_') { | |
newqs.push(qs[i]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From here, with a few improvements (options classes argument, ability to pass plain text in): | |
// http://stackoverflow.com/questions/118241/calculate-text-width-with-javascript | |
(function($) { | |
$.textMetrics = function(el, classes) { | |
var h = 0, w = 0; | |
var div = document.createElement('div'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.log = function (msg) { | |
console.log("%s: %o", msg, this); | |
return this; | |
}; | |
// $('selector').log('BEGIN') | |
// .css('color', 'red') | |
// .log('new value') | |
// // etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var re = /\d{6}/, | |
dt = re.exec(document.location.href)[0]; | |
var m = dt.slice(0,2), | |
d = dt.slice(2,4), | |
y = dt.slice(4); | |
y = y.charAt(0)==='0' ? '20'+y : '19'+y; | |
dt = newDate(y, parseInt(m,10)-1, d); | |
dt.setDate(dt.getDay()===5 ? dt.getDate()+3 : dt.getDate()+2); | |
y = dt.getFullYear().toString().slice(2); | |
m = dt.getMonth(); m++; m = m.toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defadvice rec-fib (around rec-fib-memoize compile activate) | |
(let* ((memo-table (memo-table-for-symbol 'rec-fib)) | |
(arg (ad-get-arg 0)) | |
(result (gethash arg memo-table))) | |
(if result | |
(setq ad-return-value result) | |
ad-do-it | |
(puthash arg ad-return-value memo-table)))) |