Skip to content

Instantly share code, notes, and snippets.

View tomphp's full-sized avatar

Tom Oram tomphp

View GitHub Profile
### Keybase proof
I hereby claim:
* I am tomphp on github.
* I am tomoram (https://keybase.io/tomoram) on keybase.
* I have a public key ASB2-5Vv65haxi1hqeFEhF4m7z_7WzFpet0w5IID9JXdLAo
To claim this, I am signing this object:
from hypothesis import given
from hypothesis.strategies import text
def reverse(string):
return string
@given(text())
def test_reverse_reverse_is_the_original(s):
assert s == reverse(reverse(s))
@tomphp
tomphp / bitmap.rb
Last active November 13, 2017 21:45
RSpec.describe 'acceptance test' do
xit 'works' do
runner = CommandRunner.new(Tokenizer.new)
expect(runner.run(
'I 5 5',
'C 1',
'V 2 5 3 4',
'H 5 1 4 3',
'P 4 2 2',
package go_coin_change
func ExampleChange(amount uint) []uint {
result := []uint{}
coins := []uint{10, 5, 2, 1}
for _, coin := range coins {
for amount >= coin {
result = append(result, coin)
@tomphp
tomphp / Tennis.idr
Last active April 8, 2018 11:58
Tennis Scoring Kata in Idris [WIP]
%default total
data Player = P1 | P2
-- How can we prove that it's not the same player?
otherPlayer : Player -> Player
otherPlayer P1 = P2
otherPlayer P2 = P1
data PointValue = Love | Fifteen | Thirty | Forty
%default total
data Player = P1 | P2
-- How can we prove that it's not the same player?
otherPlayer : Player -> Player
otherPlayer P1 = P2
otherPlayer P2 = P1
data PointValue = Love | Fifteen | Thirty | Forty
@tomphp
tomphp / form.markdown
Created September 10, 2018 18:50
Form Markdown

My Questionnaire

1. What's your name?


2. What's your favourite colour?

( ) Red ( ) Green

@tomphp
tomphp / TennisSpec.hs
Created April 15, 2019 21:08
Incomplete tennis kata created with @JDurstberger at the LSCC coding dojo in the Moonpig office.
module TennisSpec where
import Test.Hspec
data Point
= Love
| Fifteen
| Thirty
| Forty
deriving (Enum, Eq, Show)
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
import Control.Monad ((>=>))
{-
-- Initial style
data Console a = GetLine String (String -> Console a)
@tomphp
tomphp / Main.hs
Created June 19, 2019 18:58
Code from Success & Failure Book
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UnicodeSyntax #-}
module Main where
import Control.Lens
import Control.Monad ((>=>))