Skip to content

Instantly share code, notes, and snippets.

View michaelt's full-sized avatar

michaelt michaelt

  • twitter antiphasis_
View GitHub Profile
@michaelt
michaelt / minecraft.hs
Created December 3, 2010 16:18
cabal install she + pragma + import Control.Applicative
{-# OPTIONS_GHC -F -pgmF she #-}
module Minecraft
( ClientToServerPacket(..)
, ServerToClientPacket(..)
, MCInventoryItem
, MCInventoryUpdate
, MCBlockChange
, MCMultiBlockChange
, MCExplosionRecords
) where
@michaelt
michaelt / amity.hs
Created December 3, 2010 16:23 — forked from DylanLukes/amity.hs
with idiom brackets in minecraft.hs
import System.IO
import Network
import Minecraft
import Control.Monad
import Control.Monad.Fix
import Control.Monad.Trans
import Control.Monad.BinaryProtocol
import Control.Concurrent
import Control.Concurrent.STM
import Control.Concurrent.STM.TChan
@michaelt
michaelt / latex.template
Created June 9, 2011 21:23
Simple Pandoc default.latex with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.
@michaelt
michaelt / latex.template
Created June 9, 2011 21:23
Simple Pandoc latex.template with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% This ^^^ is a standard LaTeX document class declaration
% (the previous line is a pseudo-comment, declaring that we will
% use the special XeTeX machinery for its more extensive font list
% and its use of unicode.)
% If you made this line more akin to the one in the default
% latex.template file, say:
% \documentclass$if(fontsize)$[$fontsize$]$endif${scrartcl}
@michaelt
michaelt / a.bib
Created December 9, 2011 11:02
a.bib
@article{nordstrom1993,
title={A prospective study},
author={Nordstr{\"o}m, M.},
journal={Journal of internal medicine},
volume={232},
number={2},
pages={155--160},
year={1992},
publisher={Wiley Online Library}
}
@michaelt
michaelt / default.scriptogram
Created February 23, 2012 14:44
pandoc + mathjax + scriptogr.am
---
$if(date)$
Date: $date$
$endif$
$if(title)$
Title: $title$
$endif$
---
<div>
@michaelt
michaelt / pipe_conduit.hs
Created March 26, 2012 08:18
simplified Control.Pipe.Common following Twan van Laarhoven's pipe-conduit hybrid
-- http://www.reddit.com/r/haskell/comments/rbgvz/conduits_vs_pipes_using_void_as_an_input_or
import Control.Monad
import Control.Applicative
import Data.Void
import System.IO
data Pipe m i o r =
Finished (Maybe i) r
| PipeM (m (Pipe m i o r)) (m r)
@michaelt
michaelt / Jade.hs
Created May 6, 2012 19:13 — forked from scan/Jade.hs
Jade2.hs
{-#LANGUAGE OverloadedStrings#-}
module Jade where
import Text.Parsec
import qualified Text.Parsec.Token as L
import Text.Parsec.Language (emptyDef)
import Text.Parsec.Text (Parser)
import Data.Text (Text)
import Control.Monad (mzero)
import Control.Applicative ((<$>),(*>), (<*))
(☃) :: Int -> Int -> Int
x ☃ y = x + y
main = print $ 0 ☃ 1 ☃ 2
@michaelt
michaelt / RedBlackTree.hs
Created May 11, 2012 15:01 — forked from rampion/RedBlackTree.hs
red-black trees in haskell, using GADTs and Zippers (and DataKinds)
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DataKinds#-}
{-# LANGUAGE KindSignatures#-}
module RedBlackTree where
data Nat = Zero | Succ Nat deriving (Eq, Ord, Show)
type One = Succ Zero