Skip to content

Instantly share code, notes, and snippets.

View sleepyfox's full-sized avatar
:shipit:

@sleepyfox sleepyfox

:shipit:
  • TypeError
  • The Midlands
View GitHub Profile
@sleepyfox
sleepyfox / magna_carta.txt
Created March 17, 2014 18:19
Magna Carta - British Library translation
JOHN, by the grace of God King of England, Lord of Ireland, Duke of Normandy and Aquitaine, and Count of Anjou, to his archbishops, bishops, abbots, earls, barons, justices, foresters, sheriffs, stewards, servants, and to all his officials and loyal subjects, Greeting.
KNOW THAT BEFORE GOD, for the health of our soul and those of our ancestors and heirs, to the honour of God, the exaltation of the holy Church, and the better ordering of our kingdom, at the advice of our reverend fathers Stephen, archbishop of Canterbury, primate of all England, and cardinal of the holy Roman Church, Henry archbishop of Dublin, William bishop of London, Peter bishop of Winchester, Jocelin bishop of Bath and Glastonbury, Hugh bishop of Lincoln, Walter Bishop of Worcester, William bishop of Coventry, Benedict bishop of Rochester, Master Pandulf subdeacon and member of the papal household, Brother Aymeric master of the knighthood of the Temple in England, William Marshal earl of Pembroke, William earl of Salisbury, William ea
module StarterSpec where
-- Details of Hspec at http://hspec.github.io
import Test.Hspec
main :: IO ()
main = hspec $ do
describe "An empty list" $ do
it "should have length zero" $
@sleepyfox
sleepyfox / Build.sbt
Last active August 29, 2015 14:01
Test stub for ScalaTest for London Code Dojo 7L7W Scala day 1
name := "Name goes here"
version := "0.0.1"
libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.0" % "test"
@sleepyfox
sleepyfox / tdd_starter.erl
Created May 10, 2015 18:35
TDD in Erlang with EUnit
-module(tdd_starter).
-export([sum/2, product/2]).
-include_lib("eunit/include/eunit.hrl").
sum(A, B) -> A + B.
product(A, B) -> A * B.
sum_test() ->
?assertEqual(0, sum(0, 0)),
@sleepyfox
sleepyfox / roman.py
Last active August 29, 2015 14:21
Python TDD starter
"A test suite for a Roman numeral converter"
import unittest
class RomanNumeral():
def toNumeral(self, v):
return True
class RomanNumerals(unittest.TestCase):
@sleepyfox
sleepyfox / fizzbuzz.coffee
Created December 26, 2011 15:33
Fizz Buzz implementation in Coffeescript
rules = [
{ divisor: 3, word: "fizz" }
{ divisor: 5, word: "buzz" }
]
fizzBuzz = (n) ->
say = ""
say += i.word for i in rules when n % i.divisor is 0
say || n
@sleepyfox
sleepyfox / example-code2.java
Created February 19, 2012 11:46
Some more complex Java code for Code Dojo 4
/*****
* This is a test program with 5 lines of code
* \/* no nesting allowed!
//*****//***/// Slightly pathological comment ending...
public class Hello {
public static final void main(String [] args) { // gotta love Java
// Say hello
System./*wait*/out./*for*/println/*it*/("Hello/*");
}
@sleepyfox
sleepyfox / example-code.java
Created February 19, 2012 11:44
Some Java code for Code Dojo 4
// This file contains 3 lines of code
public interface Dave {
/**
* count the number of lines in a file
*/
int countLines(File inFile); // not the real signature!
}
@sleepyfox
sleepyfox / gist:1879125
Created February 21, 2012 21:37
Deck of cards - hand of 5 random cards sorted by Black->Red, Spades->Clubs, Diamonds->Hearts, A high
suits = ["Hearts", "Diamonds", "Clubs", "Spades"]
cards = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]
class Card
constructor: (value, suit) ->
@suit ?= suits[random(4)]
@value ?= cards[random(13)]
toString: ->
"#{@value} of #{@suit}"
@sleepyfox
sleepyfox / nested-comprehension.coffee
Created February 21, 2012 23:37
Nested array comprehension in CoffeeScript
cards = ["2", "3", "4"] # etc...
suits = ["hearts", "spades"] # etc...
array = (a+b for a in cards for b in suits)
alert array