Skip to content

Instantly share code, notes, and snippets.

Hacking up a storm!

Steve Purcell purcell

Hacking up a storm!
Block or report user

Report or block purcell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View elisp-shuffles.el
(defun key-quiz--shuffle-list (list)
"Shuffles LIST randomly, modying it in-place."
(dolist (i (reverse (number-sequence 1 (1- (length list)))))
(let ((j (random (1+ i)))
(tmp (elt list i)))
(setf (elt list i) (elt list j))
(setf (elt list j) tmp)))
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
View mood-one-theme-fringe.el
;;; mood-one-theme-fringe.el --- Fringe bitmap definitions for the Mood One theme. -*- lexical-binding: t; -*-
;;; Commentary:
;; This file is responsible for defining custom fringe bitmaps
;; of supported packages for the Mood One theme.
;; If you use `diff-hl', then use this:
;; (setq diff-hl-fringe-bmp-function #'mood-one-theme--diff-hl-bmp-fn)
purcell / Aggregation.purs
Last active May 11, 2019
Multiple aggregates in a single pass, using Purescript
View Aggregation.purs
-- This is based on ideas from the excellent article "Beautiful Aggregations
-- with Haskell" by Evan Borden:
module Aggregation where
import Prelude
import Data.Foldable (foldMap)
import Data.Monoid.Additive (Additive(..))
import Data.Newtype (un)
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 / migrations.sql
Last active Sep 16, 2017
PostgreSQL schema migrations system
View migrations.sql
This code now lives in its own repo at
purcell / code-font-user-styles.css
Last active Sep 4, 2017
User styles for coding fonts on sites with lots of code
View code-font-user-styles.css
@-moz-document domain(''), domain('') {
tt, code, pre, .file-data pre, textarea, .blob-line-code, .blob-code, .diff-line-code {
font-family: "Iosevka Term", "Iosevka", "Input Mono Condensed", "PragmataPro", "Ubuntu Mono", "Menlo";
font-weight: 400;
@-moz-document domain('') {
tt, code, pre, textarea, .code, .file-content.code pre code {
font-family: "Iosevka Term", "Iosevka", "Input Mono Condensed", "PragmataPro", "Ubuntu Mono", "Menlo";
font-weight: 400;
purcell / iosevka
Last active Aug 17, 2017
Mac custom-build of Iosevka with Pragmata-like features
View iosevka
#!/bin/sh -e
if [ -d "$DIR" ]; then
(cd $DIR && git pull)
git clone --depth 1 $DIR
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
You can’t perform that action at this time.