This file contains hidden or 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
| module Classifier | |
| ( Classifier(..) | |
| , empty | |
| , update | |
| , union | |
| , classify | |
| , singleton | |
| , scaled | |
| , test | |
| ) where |
This file contains hidden or 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
| module Main where | |
| import Text.Parsec | |
| import Text.Parsec.String | |
| main :: IO () | |
| main = do | |
| input <- getLine |
This file contains hidden or 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
| 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] |
This file contains hidden or 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/sh -e | |
| # https://github.com/be5invis/Iosevka#build-your-own-style | |
| DIR=~/Projects/External/iosevka | |
| if [ -d "$DIR" ]; then | |
| (cd $DIR && git pull) | |
| else | |
| git clone --depth 1 https://github.com/be5invis/Iosevka $DIR | |
| fi |
This file contains hidden or 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
| @-moz-document domain("github.com"), domain("gist.github.com") { | |
| tt, code, pre, .file-data pre, textarea, .blob-line-code, .blob-code, .blob-code-inner, .diff-line-code { | |
| font-family: "Iosevka Fixed SS08", "Iosevka Fixed", "Iosevka Term", "Iosevka", "Input Mono Condensed", "PragmataPro", "Ubuntu Mono", "Menlo"; | |
| font-weight: 400; | |
| } | |
| } | |
| @-moz-document domain("gitlab.com") { | |
| tt, code, pre, textarea, .code, .file-content.code pre code { | |
| font-family: "Iosevka Fixed SS08", "Iosevka Fixed", "Iosevka Term", "Iosevka", "Input Mono Condensed", "PragmataPro", "Ubuntu Mono", "Menlo"; |
This file contains hidden or 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
| This code now lives in its own repo at https://github.com/purcell/postgresql-migrations |
This file contains hidden or 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 -e | |
| image=mdillon/postgis:9.6-alpine | |
| container_name=my-app-postgresql | |
| if [ -z "$1" ]; then | |
| echo "Run command with a dockerised PostgreSQL DB. | |
| usage: $(basename "$0") command |
This file contains hidden or 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
| -- This is based on ideas from the excellent article "Beautiful Aggregations | |
| -- with Haskell" by Evan Borden: https://tech.freckle.com/2017/09/22/aggregations/ | |
| module Aggregation where | |
| import Prelude | |
| import Data.Foldable (foldMap) | |
| import Data.Monoid.Additive (Additive(..)) | |
| import Data.Newtype (un) |
This file contains hidden or 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
| {-# 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 |
This file contains hidden or 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
| (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))) | |
| list) |