Skip to content

Instantly share code, notes, and snippets.

@Icelandjack
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)
  deriving 
    (Functor, Show)
  deriving newtype 
    Applicative

instance (Applicative f, Num a) => Num (WrappedApplicative f a) where
@borgfriend
borgfriend / maya2017install.sh
Last active Feb 21, 2021
Maya 2017 Installation on Ubuntu 16.04
View maya2017install.sh
#!/bin/bash
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
echo Just type “sudo !!
exit
fi
#Check for 64-bit arch
if [uname -m != x86_64]; then
@jpt4
jpt4 / lc2016-unconf.txt
Created May 29, 2016
LambdaConf 2016 Unconference Schedule (Tentative)
View lc2016-unconf.txt
UTC20160530
LambdaConf 2016 Unconference Schedule (Tentative)
A115
1:00 - 3:00 PM
Engineering a Better Twitter panel
3:00 - 3:30 PM
0 - Becoming a LambdaConf Speaker
@erantapaa
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:
https://www.reddit.com/r/dailyprogrammer/comments/3ntsni/20151007_challenge_235_intermediate_scoring_a/
@nasser
nasser / core.clj
Last active Sep 30, 2015
LIES core
View core.clj
(ns lies.core
(:use arcadia.core
lies.messages)
(: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
varemenos / 1.README.md
Last active May 6, 2021
Git log in JSON format
View 1.README.md

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
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
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
romainl / deprecation.md
Last active May 18, 2021
Idiomatic vimrc
View deprecation.md