Skip to content

Instantly share code, notes, and snippets.

View tormaroe's full-sized avatar
💭
Doing some Go and then som JavaScript at the moment

Torbjørn Marø tormaroe

💭
Doing some Go and then som JavaScript at the moment
View GitHub Profile
module Test
module Unit
TestCase = RSpec::Core::ExampleGroup
end
end
class Test::Unit::TestCase
def self.inherited(host)
host.set_it_up host.name.gsub(/(Spec|Test)/,'')
def host.method_added(name)
@kevinolsen
kevinolsen / gist:845908
Created February 27, 2011 04:41
conway idea
require 'test/unit'
class Conway
def self.map_new_world(world)
interstitial_world = {}
world.each do |location|
(location[0]-1).upto(location[0]+1) do |x|
(location[1]-1).upto(location[1]+1) do |y|
interstitial_world[[x, y]] ||= {}
interstitial_world[[x, y]][:alive] = true and next if location[0] == x and location[1] == y
@tormodfj
tormodfj / gist:464380
Created July 5, 2010 14:08
Calculate Roman numerals with F#
module RomanNumerals
// Define function
let convertToRoman n =
let steps = [
(1, 3, "I")
(4, 4, "IV")
(5, 8, "V")
(9, 9, "IX")
// Tiniest BDD DSL/framework around?
// Licensed under MSPL/FreeBSD/ISC or any other OSS license you want
// Original idea from http://blog.kjempekjekt.com/2009/08/13/ultra-tiny-given-when-then-dsl-snippet/,
// turned into generic base class by Jonas Follesø.
public abstract class BDD<T> where T : BDD<T>
{
protected T Given { get { return (T)this; } }
protected T And { get { return (T)this; } }
protected T When { get { return (T)this; } }