Skip to content

Instantly share code, notes, and snippets.

View akisaarinen's full-sized avatar

Aki Saarinen akisaarinen

View GitHub Profile
@akisaarinen
akisaarinen / README.md
Last active August 29, 2015 14:25 — forked from mbostock/.block
Aki chart lol

Testing

@akisaarinen
akisaarinen / FunctionalPong.scala
Created September 22, 2012 14:29
Functional Pong
package pong.functional
sealed trait Event
sealed trait Action
object Action {
case object MoveUp extends Action
case object MoveDown extends Action
case object ShootMissile extends Action
}
@akisaarinen
akisaarinen / ImperativePong.scala
Created September 22, 2012 14:27
Imperative Pong
package pong.imperative
sealed trait Event
class PongConnection {
def isConnected(): Boolean = sys.error("not implemented")
def readEvent(): Event = sys.error("not implemented")
def moveUp(): Unit = sys.error("not implemented")
def moveDown(): Unit = sys.error("not implemented")
def shootMissile(): Unit = sys.error("not implemented")
@akisaarinen
akisaarinen / gist:3402702
Created August 20, 2012 09:42
XMLReport.java
/*
* Cobertura - http://cobertura.sourceforge.net/
*
* Copyright (C) 2003 jcoverage ltd.
* Copyright (C) 2005 Mark Doliner
* Copyright (C) 2005 Jeremy Thomerson
* Copyright (C) 2006 Jiri Mares
* Copyright (C) 2008 Julian Gamble
*
* Cobertura is free software; you can redistribute it and/or modify
@akisaarinen
akisaarinen / gist:1487983
Created December 16, 2011 21:07
VectorSpeedTest results
[info] Running vectortest.VectorSpeedTest
Result: Pos2d(12300003.00, 45600002.00) [0.224s] For Vec2d: Simplest
Result: Pos2d(12300003.00, 45600002.00) [0.437s] For Vec2dNumeric: Parameterized numeric type
Result: Pos2d(12300003.00, 45600002.00) [2.858s] For GenVec2d: Generalized size (specialized implementation for 2D)
Result: Pos2d(12300003.00, 45600002.00) [7.516s] For GenVec: Generalized size (parameterized)
@akisaarinen
akisaarinen / VectorSpeedTest.scala
Created December 16, 2011 21:05
Vector (in math sense) speed test
package vectortest
// -------------------------------------------------------------
// Simplest possible implementation, no parameterization
// -------------------------------------------------------------
class Pos2d(val x: Double, val y: Double) {
def +(that: Vec2d): Pos2d = {
Pos2d(x + that.x, y + that.y)
}
function importModule(target, module) {
for (var method in module)
target[method] = module[method]
}
BASE = (function() {
var exports = {
getFoo: function() { return 'foo' }
}
return exports