This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('child_process').exec; | |
LED = { | |
on: function() { | |
sys('setleds -L +caps </dev/tty0'); | |
}, | |
off: function() { | |
sys('setleds -L -caps </dev/tty0'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
alias dp puts | |
def puts (*args) | |
args.any?? dp(*args.dup) : dp(self) | |
end | |
end | |
table, anon = File.read('table.txt').lines, | |
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATE="$1" | |
yymmdd() { | |
date -d"$DATE" '+%Y%m%d' | |
}; | |
cat <<EOF | sed 's/^ *//' | |
BEGIN:VCALENDAR | |
VERSION:2.0 | |
PRODID:-//Hack and Tell//NONSGML v1.0//EN | |
BEGIN:VEVENT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a (m,n) | m==0 = n+1 | |
| m>0 && n==0 = a(m-1,1) | |
| m>0 && n>0 = a(m-1,a(m,n-1)) | |
k c n d | n == 0 = c*d | |
| n == 1 = c^d | |
| d == 0 = 1 | |
| otherwise = k c (n-1) $ k c n (d-1) | |
g = (!!63) $ iterate (\ n -> k 3 n 3) 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env runhaskell | |
{-# LANGUAGE DeriveDataTypeable #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} | |
-- # [Task:](http://functionaljobs.com/jobs/8678-haskell-developer-at-zalora) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Four Postures of Death | |
Sidney Keyes | |
August 1941 | |
--- | |
I | |
DEATH AND THE MAIDEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Prelude hiding (foldr, filter) | |
import Data.Maybe (fromJust, isJust) | |
import Data.Foldable (Foldable(foldr)) | |
import Data.HashMap.Lazy (HashMap, singleton, unionWith, foldrWithKey) | |
import Data.Hashable (Hashable(..)) | |
import Data.Monoid (Monoid(mappend, mempty)) | |
import Data.Vector (Vector, find, cons, filter) | |
-- sniEquivalence describes a surjective but non-injective relation between | |
-- {b, a}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE RankNTypes #-} | |
data N = Z | S N | |
data Vector :: * -> N -> * where | |
Nil :: Vector a 'Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allOf :: Enum a => Bounded a => [a] | |
allOf = [minBound..maxBound] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad (liftM2) | |
import Control.Arrow (Arrow((&&&)), (>>>), (<<<)) | |
(>>|) :: Arrow a => a b c -> a c d -> a b (c,d) | |
(>>|) = liftM2 (<<<) (&&&) (>>>) |
OlderNewer