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 titan = titan || {} | |
//===----------------------------------------------------------------------===// | |
// Data | |
//===----------------------------------------------------------------------===// | |
titan.tiles = [ | |
{ name: 'grass' }, | |
]; |
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.Arrow | |
import Control.Monad | |
import Control.Monad.Random | |
import Data.List | |
import Data.Map | |
import Data.Maybe | |
-- A monad which represents a random integer from 1-6 | |
die :: (RandomGen g) => Rand g Int | |
die = getRandomR (1,6) |
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
DEPS=$(cat urls.txt | grep -o "\w\+\.\w\+$") | |
redo-ifchange $DEPS |
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
open FParsec.Primitives | |
open FParsec.CharParsers | |
type CsvResult = { IsSuccess : bool; ErrorMsg : string; Result : string list list } | |
// Some simple helpers | |
let isWs s = Seq.map (isAnyOf "\t ") s | |
|> Seq.reduce (&&) | |
let ws = spaces |
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 connect = require('connect') | |
, proxy = require('http-proxy') | |
function redirect(loc) { | |
return connect.createServer(function(req, res){ | |
res.writeHead(301, { "Location": loc }); | |
res.end(); | |
}); | |
} |
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
{EventEmitter} = require 'events' | |
mmap = require 'mmap' | |
path = require 'path' | |
fs = require 'fs' | |
# Used for accessing blocks | |
class Blocks | |
@chunks = {} | |
# Blocks takes a path to a world directory. |
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
vows.describe('binary-simple').addBatch | |
'a number': | |
topic: new Buffer [0x74, 0x01, 0x00, 0x01] | |
'with a big endian byte order': | |
'parses correctly': (buf) -> | |
res = binary.be buf, 3 | |
assert.equal res, 7602432 | |
'parses correctly with offset': (buf) -> | |
res = binary.be buf, 2, 1 | |
assert.equal res, 256 |
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
derp = do | |
x <- [1,2,3] | |
y <- [x, x + 1, x + 2] | |
return y | |
derp2 :: [Int] | |
derp2 = concatMap (\x -> [x, x + 1, x + 2]) [1,2,3] | |
-- derp == derp2 |
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 | |
import Test.QuickCheck | |
import Test.QuickCheck.Gen | |
import System.Random | |
import System | |
data Serial = Serial String Int | |
instance Show Serial where | |
show (Serial prefix number) = prefix ++ show number |
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
data Error = Timeout | |
| Exception SomeException |