Skip to content

Instantly share code, notes, and snippets.

View purcell's full-sized avatar

Steve Purcell purcell

View GitHub Profile
@purcell
purcell / code-font-user-styles.css
Last active October 22, 2020 22:55
User styles for coding fonts on sites with lots of code
@-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";
@purcell
purcell / iosevka
Last active June 13, 2020 16:35
Mac custom-build of Iosevka with Pragmata-like features
#!/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
@purcell
purcell / shell.nix
Last active May 22, 2020 02:43
shell.nix with nimlsp
let
# Assumes niv sources, which should include the repos for
# nimlsp, ast-pattern-matching and jsonschema.
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
unpackedSource = d: d.overrideAttrs (orig: {
name = "${orig.pname}-source";
phases = ["unpackPhase" "patchPhase" "installPhase"];
installPhase = "mkdir $out; cp -aR . $out/.";
@purcell
purcell / Aggregation.purs
Last active November 18, 2019 09:52
Multiple aggregates in a single pass, using Purescript
-- 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)
@purcell
purcell / Req-reformatted.hs
Created November 3, 2019 02:52
Reformatter slowness
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 157b2dd..f3807b7 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1263,6 +1263,11 @@ the operating system.")
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
(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)
@purcell
purcell / HereQ.hs
Last active April 28, 2019 21:24
Quasi-quoter for postgresql-simple
{-# 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
purcell / emacs-osx-srgb.patch
Last active June 19, 2018 16:34
Make Emacs on OSX treat all RGB colors as being within the sRGB color space
commit 3b63b2c6e9e93adab09eace60750ed981a8e528f
Author: Steve Purcell <steve@sanityinc.com>
Date: Sat Dec 21 11:44:12 2013 +0000
Treat hex colors as sRGB (see http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8402)
diff --git a/src/nsterm.m b/src/nsterm.m
index 733c05a..0c79186 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@purcell
purcell / with-docker-db.sh
Last active March 6, 2018 22:54
Run a command against a PostgreSQL DB installed and started on demand using Docker
#!/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