Skip to content

Instantly share code, notes, and snippets.

View miikka's full-sized avatar

Miikka Koskinen miikka

View GitHub Profile
# A min-heap.
type
TNode[T] = tuple[priority: int, data: T]
TBinHeap[T] = object
heap: seq[TNode[T]]
last: int
PBinHeap[T] = ref TBinHeap[T]
@miikka
miikka / Main.hs
Created November 8, 2010 15:12
Haddock breaks when a module uses quasiquotes.
{-# LANGUAGE QuasiQuotes #-}
import Quasi
f [$qq|test|] = True
f _ = False
main = do
print [$qq|test|]
print $ f [$qq|test|]
@miikka
miikka / snap-helloworld.cabal
Created October 5, 2010 13:16
Snap project template.
Name: snap-helloworld
Version: 0.1
Category: Web
Build-type: Simple
Cabal-version: >=1.6
Executable snap-helloworld
HS-Source-dirs: src
Main-is: Main.hs
Other-modules:
@miikka
miikka / Simple.hs
Created August 24, 2010 19:07
Simple Haskell Twitter OAuth example
{-# LANGUAGE PackageImports #-}
{-
You need to register your Twitter application at <http://dev.twitter.com/>
to get the consumer key and secret needed for OAuth. When connecting to
Twitter for the first time, do this:
let consumer = Consumer "consumer key" "consumer secret"
token <- authenticate
#!/bin/sh
xsel | xmessage -buttons ok:2,not:0 -file - -timeout 4
if [ $? -eq 2 ]; then
xsel | pk notes -s
fi