I hereby claim:
- I am markhepburn on github.
- I am markhepburn (https://keybase.io/markhepburn) on keybase.
- I have a public key whose fingerprint is 65D5 8DDA 447D 1466 CB47 911B EF73 DD14 3AB3 EAC0
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
;;; Problem solved, by subterfuge. | |
(defadvice rgrep (around rgrep-rename-previous-buffer activate compile) | |
"If a previous *grep* buffer exists, offer to rename it before | |
running the new process." | |
(interactive | |
(let ((old-grep-buf (get-buffer "*grep*"))) | |
(if (and old-grep-buf | |
(y-or-n-p "Grep results buffer already exists; rename it first? ")) | |
(let ((new-buf-name (read-string "New name: "))) | |
(with-current-buffer old-grep-buf |
(defvar *mh/lisp-base* (file-name-directory (file-truename user-init-file)) | |
"Base code directory; contains free-standing code and | |
subdirectories of other projects. Defaults to the directory | |
containing the user's initialisation file (including following | |
symlinks).") | |
(add-to-list 'load-path *mh/lisp-base*) | |
;;; site-specific customisations; for now, assume that this can be | |
;;; done by platform, since it's linux at work, OSX at home. Just | |
;;; name the file the same as is reported by system-type (#'load will |
from django.conf import settings | |
from django.contrib.auth.models import User | |
import cx_Oracle | |
class OracleBackend(object): | |
"""Authenticate by attempting to establish an oracle connection. | |
Uses the database from the settings. The django user module is | |
still used for management, just not authentication.""" | |
def authenticate(self, username=None, password=None): | |
try: |
(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)))) |
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(); |
jQuery.fn.log = function (msg) { | |
console.log("%s: %o", msg, this); | |
return this; | |
}; | |
// $('selector').log('BEGIN') | |
// .css('color', 'red') | |
// .log('new value') | |
// // etc |
// 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'); |
// 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]); | |
} | |
} |