Skip to content

Instantly share code, notes, and snippets.

@safx
safx / bowling.hs
Last active December 26, 2015 13:19
ボウリングのスコアを計算するスクリプト
score' :: Int -> Char -> Int
score' _ '-' = 0
score' b '/' = 10 - b
score' _ 'X' = 10
score' _ '1' = 1
score' _ '2' = 2
score' _ '3' = 3
score' _ '4' = 4
score' _ '5' = 5
score' _ '6' = 6
@safx
safx / bowling.ls
Created October 23, 2013 16:08
ボウリングのスコアを計算するスクリプト
#_ = require \prelude-ls
class Frame
(pin, prev)->
@cell = pin
@prev = prev
@next = null
prev.next = this if prev?
#frameScore: -> _.fold (+), 0, @cell
@safx
safx / gist:3366866
Created August 16, 2012 04:32
Power Line for Emacs
(defun dither-xpm (color1 color2)
"Return an XPM dither string representing."
(format "/* XPM */
static char * dither[] = {
\"12 18 2 1\",
\". c %s\",
\" c %s\",
\"....... . . \",
\".. . . . \",
\"..... . . . \",