Skip to content

Instantly share code, notes, and snippets.

View markhibberd's full-sized avatar

markhibberd markhibberd

View GitHub Profile
@bradclawsie
bradclawsie / wai-sample.hs
Created April 1, 2012 05:48
complete wai/warp sample server
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wai
import Network.Wai.Handler.Warp
import Network.HTTP.Types
import qualified Data.Text as T
import Data.Time.Clock
import Data.Time.Format
@nkpart
nkpart / dirwatch
Created February 9, 2011 06:52 — forked from markhibberd/dirwatch
#!/bin/sh
#
# NAME
# dirwatch - run command on file modification
#
# SYNOPSIS
# dirwatch [-m marker] command dir ...
#
# DESCRIPTION
# dirwatch uses a touch file to track whether files
@sunilnandihalli
sunilnandihalli / curry.clj
Created December 17, 2010 20:33
a macro to create fixed-arity curryable function in clojure
(defmacro def-curry-fn [name args & body]
{:pre [(not-any? #{'&} args)]}
(if (empty? args)
`(defn ~name ~args ~@body)
(let [rec-funcs (reduce (fn [l v]
`(letfn [(helper#
([] helper#)
([x#] (let [~v x#] ~l))
([x# & rest#] (let [~v x#]
(apply (helper# x#) rest#))))]