Skip to content

Instantly share code, notes, and snippets.


Steve Purcell purcell

View GitHub Profile
purcell / color-utils.el
Created Oct 17, 2011
A few hacky color-related functions
View color-utils.el
(defun format-color (rgb)
"Convert a triplet of floating point (0.0-1.0) RGB values into
a hex triplet"
(apply 'format "#%02x%02x%02x"
(mapcar (lambda (x) (* 255 x)) rgb)))
(defconst colour-triplet-regex
View gist:1300810
(defn follow-chain [base-url number]
(let [result (slurp (str base-url number))]
(if-let [next-number
(if (re-find #"^Yes" result)
(/ (Integer/parseInt number) 2)
(let [idx (.indexOf result "and the next")]
(when (>= idx 0)
(last (string/split (subs result idx) #" ")))))]
(println result)
View oxtail-stew.markdown

Oxtail stew recipe

By Steve Purcell

Serves 2-3. Prep time: 20 mins. Cooking time: around 4 1/2 hrs.

This stew is rich and satisfying, not to mention deceptively healthy, easy to make, and dirt cheap.

purcell / completion.js
Created Nov 28, 2011
Cached autocompletion of wikipedia page titles with jquery ui autocomplete plugin
View completion.js
function cached_completer(completer) {
var cache = {};
return function(request, response) {
if (request.term in cache) {
} else {
completer(request, function(resp) {
cache[request.term] = resp;
View wikipedia.js
// Wikipedia
(function(w) {
var call_wikipedia_api = function(data, callback) {
url: "",
data: $.extend({ format: "json" }, data),
dataType: "jsonp",
View *vimgolf-keystrokes*
Challenge ID: 4d28aef94bcd032f1c0000dc
Keystrokes (28):
M-f M-4 M-d <down> M-f M-f M-3 M-d <down> M-f M-f M-6 M-d C-y M-y M-y <up> M-b M-b <left> C-y M-y <up> M-5 M-b <left> C-y M-y
Full command log:
M-f forward-word
View init-elpa.el
(defvar package-filter-function nil
"Optional predicate function used to internally filter packages used by package.el.
The function is called with the arguments PACKAGE VERSION ARCHIVE, where
PACKAGE is a symbol, VERSION is a vector as produced by `version-to-list', and
ARCHIVE is the string name of the package archive.")
(defadvice package--add-to-archive-contents
(around filter-packages (package archive) activate)
"Add filtering of available packages using `package-filter-function', if non-nil."
View init-elpa.el
(defadvice package-download-transaction
(around disable-keepalives (&optional args) activate)
"Disable HTTP keep-alives to work around network issues with Melpa host."
(let ((url-http-attempt-keepalives nil))
View gist:2235826
==> Downloading
Already downloaded: /Users/steve/Library/Caches/Homebrew/metapixel-1.0.2.tar.gz
/usr/bin/tar xf /Users/steve/Library/Caches/Homebrew/metapixel-1.0.2.tar.gz
==> make CC=/usr/bin/llvm-gcc MACOS_LDOPTS=-L/usr/local/lib MACOS_CCOPTS=-Os -w -pipe -march=core2 -msse4.1 -I/usr/local/include
make CC=/usr/bin/llvm-gcc MACOS_LDOPTS=-L/usr/local/lib MACOS_CCOPTS=-Os -w -pipe -march=core2 -msse4.1 -I/usr/local/include
/usr/bin/llvm-gcc -Os -w -pipe -march=core2 -msse4.1 -I/usr/local/include -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c metapixel.c
/usr/bin/llvm-gcc -Os -w -pipe -march=core2 -msse4.1 -I/usr/local/include -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I. -Irwimg -Wall -O2 -DMETAPIXEL_VERSION=\"1.0.2\" -DRWIMG_JPEG -DRWIMG_PNG -DRWIMG_GIF -c vector.c
/usr/bin/llvm-gcc -Os -w -pipe -march=core2 -msse4.1 -I/usr/local/incl
View gist:2235835
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
You can’t perform that action at this time.