Skip to content

Instantly share code, notes, and snippets.

jagbolanos / dfsalgorithms.hs
Created March 5, 2011 23:37
Some DFS based graph algorithms in Haskell
--Proposed solutions to problems 87,88 and 89 of "99 Haskell Problems"
--Not optimal but they work
--If you know haskell and want to solve some problems there are some missing at:
import Data.List
type Node = Int
type Edge = (Node,Node)
type Graph = ([Node],[Edge])
TooTallNate / .gitignore
Created July 9, 2011 04:05
low-level objc runtime apis
simonmichael / gist:1185421
Created September 1, 2011 03:59
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
echo unregistering $p; ghc-pkg $* unregister $p
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
mikeyk / gist:1329319
Created October 31, 2011 22:56
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
joefiorini / gist:1511971
Created December 22, 2011 21:37
Backbone + Stripe = AWESOME
class Stripe.TokenRequest extends Backbone.Model
validate: (attrs)->
error =
if !
attribute: "name"
message: "Please enter your name"
else if !
attribute: "email"
message: "Invalid email"
else if !Stripe.validateCardNumber(attrs.number)
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

kowey / gist:2420144
Created April 19, 2012 10:29 — forked from cartazio/gist:1655271
Haskell GTK on 64 bit MacOS X


  • on lion (and snow leopard i suppose), make sure you are using a 64 bit install of ghc. Also, unless you are suggesting an edit to these directions, please go ask people on the relevant mailing list or wiki for help :)
  • Tested on ghc 7.2.2, assumes you have standard developer things installed on mac, like x11 and stuff
  • Also tested on GHC 7.0.4 (Haskell Platform) with XCode 4.3.
  • These notes were originally brought to you by Carter Schonwald; the “I” probably refers to him. Eric Kow will refer to himself in the third person).

GHC 7.4.x

  • gtk2hs 0.12.2 won't build with ghc 7.4.1, but the current darcs repo for gtk2hs does build
ahammar / RebindableIf.hs
Created May 11, 2012 04:15
Example of overloading if-then-else in Haskell
{-# LANGUAGE RebindableSyntax #-}
import Prelude
data Height = Tall | Short
class IfThenElse b where
ifThenElse :: b -> a -> a -> a
instance IfThenElse Bool where
mikehaertl / gist:3258427
Created August 4, 2012 15:40
Learn you a Haskell - In a nutshell

Learn you a Haskell - In a nutshell

This is a summary of the "Learn You A Haskell" online book under

1. Introduction

  • Haskell is a functional programming language.
mnzk / csv-bnf-rfc4180.txt
Created April 20, 2013 13:44
CSV BNF (RFC4180) for instaparse
file = [header CRLF] record (CRLF record)* [CRLF]
header = name (COMMA name)*
record = field (COMMA field)*
name = field
field = (escaped | non-escaped)
non-escaped = TEXTDATA*
COMMA = '\u002C'
CR = '\u000D'