Skip to content

Instantly share code, notes, and snippets.

View willf's full-sized avatar
✒️
pondering

Will Fitzgerald willf

✒️
pondering
View GitHub Profile
@willf
willf / scala.el
Created September 3, 2013 14:51 — forked from stew/scala.el
; scala-mode2 found here: https://github.com/hvesalai/scala-mode2 is much better than the scala mode that comes with scalac
(add-to-list 'load-path "~/.emacs.d/scala-mode2/")
(require 'scala-mode)
; http://www.emacswiki.org/emacs/RainbowDelimiters
(add-hook 'scala-mode-hook 'rainbow-delimiters-mode)
; I get ensime from git:
; https://github.com/aemoncannon/ensime
; then run `sbt stage` inside the ensime source directory,
object GOption {
def some[A](a: A): GOption[A] = new GOption[A] {
def cata[B](n: => B, s: A => B): B = sys.error("Implement me")
}
def none[A]: GOption[A] = new GOption[A] {
def cata[B](n: => B, s: A => B): B = sys.error("Implement me")
}
}
trait GOption[+A] {
@willf
willf / stats.rb
Created September 16, 2009 03:21 — forked from mojombo/stats.rb
one pass through records (for mean and variance); annoyingly proper definition of median
# Run the given block +num+ times and then print out the mean, median, min,
# max, and stddev of the run. For example:
#
# irb> stats(10) { sleep(rand / 100) }
# mean: 5.99ms
# median: 6.76ms
# min: 1.49ms
# max: 9.28ms
# stddev: 2.54ms