Skip to content

Instantly share code, notes, and snippets.

Icelandjack / newtype_wrappers.markdown
Last active Nov 26, 2017
Newtype wrappers for deriving
View newtype_wrappers.markdown

Getting Num, Floating, Fractional from Applicative

newtype WrappedApplicative f a = WrapApplicative (f a)
    (Functor, Show)
  deriving newtype 

instance (Applicative f, Num a) => Num (WrappedApplicative f a) where
borgfriend /
Last active Feb 21, 2021
Maya 2017 Installation on Ubuntu 16.04
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
echo Just type “sudo !!
#Check for 64-bit arch
if [uname -m != x86_64]; then
jpt4 / lc2016-unconf.txt
Created May 29, 2016
LambdaConf 2016 Unconference Schedule (Tentative)
View lc2016-unconf.txt
LambdaConf 2016 Unconference Schedule (Tentative)
1:00 - 3:00 PM
Engineering a Better Twitter panel
3:00 - 3:30 PM
0 - Becoming a LambdaConf Speaker
erantapaa / bowl.lhs
Last active Nov 8, 2015
using parsec to score a bowling game
View bowl.lhs
Using Parsec to score a bowling game.
In this gist we'll see how to use Parsec to solve the problem of
scoring a bowling game. This was inspired by a
Reddit Daily Programmer problem:
nasser / core.clj
Last active Sep 30, 2015
LIES core
View core.clj
(ns lies.core
(:use arcadia.core
(:require arcadia.messages
[clojure.edn :as edn]))
(defn- type? [t]
(isa? (type t) Type))
(defn- type-map [m]
View gist:44b7063110fc423edb4d

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

varemenos /
Last active May 6, 2021
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
tom-galvin / c-machine.hs
Last active Aug 29, 2015
DailyProgrammer Challenge #208h Solution (The Universal Machine)
View c-machine.hs
-- My eyes! The goggles do nothing!
import Data.Char
import Data.List
import Data.Maybe
import qualified Data.Map.Strict as Dm
type Symbol = Char
type Alphabet = [Symbol]
type State = String
merijn / MyState.hs
Last active Jan 15, 2021
MyState homework
View MyState.hs
data MyState s a = MyState (s -> (a, s))
get :: MyState s s
get = undefined
put :: s -> MyState s ()
put = undefined
modify :: (s -> s) -> MyState s ()
modify = undefined
romainl /
Last active May 18, 2021
Idiomatic vimrc