Skip to content

Instantly share code, notes, and snippets.


Steve Purcell purcell

View GitHub Profile
purcell / HereQ.hs
Last active Apr 28, 2019
Quasi-quoter for postgresql-simple
View HereQ.hs
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
-- | Interpolate any type that inhabits both IsString and Semigroup
-- This code is based on the "here" package. It would be nice to strip
-- leading whitespace, as the "neat-interpolation" package does.
-- Additionally, "neat-interpolation" has a simpler interpolation
purcell / emacs-osx-srgb.patch
Last active Jun 19, 2018
Make Emacs on OSX treat all RGB colors as being within the sRGB color space
View emacs-osx-srgb.patch
commit 3b63b2c6e9e93adab09eace60750ed981a8e528f
Author: Steve Purcell <>
Date: Sat Dec 21 11:44:12 2013 +0000
Treat hex colors as sRGB (see
diff --git a/src/nsterm.m b/src/nsterm.m
index 733c05a..0c79186 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
purcell /
Last active Mar 6, 2018
Run a command against a PostgreSQL DB installed and started on demand using Docker
#!/bin/bash -e
if [ -z "$1" ]; then
echo "Run command with a dockerised PostgreSQL DB.
usage: $(basename "$0") command
purcell / .slate
Last active Feb 7, 2018
Slate config
View .slate
# See
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config focusPreferSameApp false
config focusCheckWidthMax 3000
config checkDefaultsOnLoad true
config windowHintsShowIcons true
config windowHintsSpread true
purcell / application_helper.rb
Created Sep 9, 2011
Make will_paginate generate HTML that bootstrap.less will render nicely
View application_helper.rb
# Based on
class BootstrapLinkRenderer < ::WillPaginate::ActionView::LinkRenderer
def html_container(html)
tag :div, tag(:ul, html), container_attributes
def page_number(page)
tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
purcell / migrations.sql
Last active Sep 16, 2017
PostgreSQL schema migrations system
View migrations.sql
This code now lives in its own repo at
View Puzzle.hs
module Puzzle where
import Data.List (permutations)
import Control.Monad (guard)
solution = do
[a,b,c,d,e,f] <- permutations "123456"
guard $ multiple 6 [a,b,c,d,e,f]
guard $ multiple 5 [a,b,c,d,e]
guard $ multiple 4 [a,b,c,d]
View Main.hs
module Main where
import Text.Parsec
import Text.Parsec.String
main :: IO ()
main = do
input <- getLine
purcell / elpa-compare.el
Created Jun 27, 2012
Compare melpa and marmalade package lists
View elpa-compare.el
(defun elpa/package-names (archive-name)
(let* ((archive-contents (expand-file-name (concat "archives/" archive-name "/archive-contents")
(names (mapcar 'car (rest (pb/read-from-file archive-contents)))))
(sort names 'string<)))
(defun list-minus (a b)
(let ((result (copy-seq a)))
(dolist (e b)
(delq e result))
View no-proxy-mode.el
;;; no-proxy-mode.el --- Temporarily disable built-in proxy settings
;; Copyright (C) 2013 by Sachin Patil
;; Author: Sachin Patil <>
;; URL:
;; Keywords: network, proxy, tool, convenience
;; Version: 0.9
;; This file is NOT a part of GNU Emacs.
You can’t perform that action at this time.