Skip to content

Instantly share code, notes, and snippets.

View markhibberd's full-sized avatar

markhibberd markhibberd

View GitHub Profile
@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#))))]
@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
@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
@paulp
paulp / The Signs of Soundness
Last active June 17, 2021 06:48
The Signs of Soundness
Hello scala, my old friend
I've come to take you home again
Because a feature slowly creeping
left me plagued with doubts and weeping
and the version that was tagged in the repo
just has to go
it lacks the signs of soundness
On sleepless nights I hacked alone
applying ant and other tools of stone
@markhibberd
markhibberd / scala-2.10.0-match-on-nothing
Created February 4, 2013 09:51
Pattern matching on `Nothing`
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.
scala> val x: Option[Nothing] = None
x: Option[Nothing] = None
scala> x match {
| case Some(a) => a
| case None => None
@cfreeman
cfreeman / gist:5105473
Last active January 16, 2016 07:41
Cheat sheet for getting started with chef.

Chef Cheat sheet

Configuring Chef

To install stuff needed to run chef in a solo mode (Small one or two server configuration):

gem install knife-solo

To setup chef after it has been installed:

@vmarquez
vmarquez / BrokenFor.scala
Last active December 14, 2015 15:18
Broken Scala For Comprehension
package vsxmpp
import scalaz.EitherT
import scalaz._
import Scalaz._
case class ABC(s:String)
object ABC {
case class Utf8String(value: String)
object Utf8String {
implicit val ArbitraryUtf8String: Arbitrary[Utf8String] =
Arbitrary(arbitrary[String] map (k =>
Utf8String(k filter (c => c < '\ud800' || c > '\udfff'))))
}
@purefn
purefn / gist:5257660
Last active December 15, 2015 12:08
// This character generator is similar to the default one from ScalaCheck, but it filters out:
// 1. Unprintable control characters. These cause problems in Mongo queries, and should not able
// to get into our database since they will not be present in inputs parsed from HTTP text.
// 2. Characters that do not exist in the default platform encoding. We can exclude a big range
// of these right away (which ScalaCheck does) because they're in the range used for two-
// character UTF-16 sequences, but others are only detected by checking Character.isDefined(_).
// The symptom of using a bad character in a string is that when you encode it to UTF-8 and
// back again, you get a different string, so any of our web and database tests that check the
// input against the output may fail-- and you'll see a question mark somewhere in the data,
// since that's how bad characters are displayed.

Installation

FreeBSD

portmaster irc/irssi
portmaster irc/irssi-xmpp

OS X

brew install irssi