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
# In-memory Cassandra-ish thingy... useful for unit tests. Maybe useful for other | |
# stuff too? No support for SuperColumns, but that should be easy enough to add. | |
import bisect | |
import copy | |
from cassandra.ttypes import NotFoundException, Column, ColumnPath, ColumnOrSuperColumn | |
class SSTable(object): |
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
http://www.infoq.com/presentations/Simple-Made-Easy | |
http://www.infoq.com/presentations/integration-tests-scam | |
http://blog.thecodewhisperer.com/2010/09/14/when-is-it-safe-to-introduce-test-doubles | |
http://youtu.be/yTkzNHF6rMs | |
http://pyvideo.org/video/1670/boundaries | |
http://skillsmatter.com/podcast/ajax-ria/enumerators | |
http://alistair.cockburn.us/Hexagonal+architecture | |
http://c2.com/cgi/wiki?PortsAndAdaptersArchitecture | |
http://www.confreaks.com/videos/977-goruco2012-hexagonal-rails | |
http://www.confreaks.com/videos/1255-rockymtnruby2012-to-mock-or-not-to-mock |
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
;; map | |
;; simple definition | |
(define (map/simple f lst) | |
(if (empty? lst) empty | |
(cons (f (first lst)) | |
(map/simple f (rest lst))))) | |
(map/simple (λ (x) (* 2 x)) '(1 2 3 4)) |
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
(* map *) | |
fun map(_, nil) = nil | |
| map(f, (head::tail)) = f(head) :: map(f, tail) | |
(* filter *) | |
fun filter(_, nil) = nil | |
| filter(p, (head::tail)) = if p(head) | |
then (head :: filter(p, tail)) |
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
#lang racket | |
(require (for-syntax racket/syntax)) | |
(require rackunit) | |
;; Macro for auto-writing tests with defines. | |
;; Syntax: | |
;; (define+test (function-name parameters ...) | |
;; ((test-input desired-result) | |
;; ...) |
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 | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the branch/status of the current git repository | |
# * the branch of the current subversion repository | |
# * the return value of the previous command | |
# | |
# USAGE: |
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
function preLoadImages () { | |
$.get($('link[rel="stylesheet"]')[0].href, function(data){ | |
r = /url\(['|"]?(\S+\.(gif|jpg|jpeg|png)[^'(]*)['|"]?\)/ig; | |
while (match = r.exec(data)){ | |
var cacheImage = document.createElement('img'); | |
cacheImage.src = match[1]; | |
} | |
}); | |
} | |
preLoadImages(); |
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
;; Detect OS | |
(defvar macosx-p (string-match "darwin" (symbol-name system-type))) | |
;; osx fixes | |
(defun insert-hash () | |
(interactive) | |
(insert "#")) | |
(defun set-exec-path-from-shell-PATH () | |
(let ((path-from-shell |
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
(setq user-emacs-directory (expand-file-name "~/Dropbox/path/to/.emacs.d/")) | |
(load (locate-user-emacs-file "init.el")) |
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 django.db import models | |
from django.utils.functional import Promise | |
from django.utils.encoding import force_unicode | |
from django.utils import simplejson as json | |
from decimal import Decimal | |
from django.core import serializers | |
from django.conf import settings | |
from django.http import HttpResponse, HttpResponseForbidden, Http404 | |
from django.core.mail import mail_admins | |
from django.db.models.query import QuerySet |
OlderNewer