Skip to content

Instantly share code, notes, and snippets.

View tomphp's full-sized avatar

Tom Oram tomphp

View GitHub Profile
@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)
@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

%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 / 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
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 / 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',
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))
### 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:
@tomphp
tomphp / example.php
Created January 14, 2016 21:21
Example of tomphp/transform __() function
<?php
// https://github.com/tomphp/php-transform
use function TomPHP\Transform\__;
$ticket1 = new Ticket(new User(['dob' => new DateTime('1980-01-22')]));
$ticket2 = new Ticket(new User(['dob' => new DateTime('1984-08-08')]));
$tickets = [$ticket1, $ticket2];
@tomphp
tomphp / gist:aa988344c4a77d52b3d5
Last active August 29, 2015 14:18
Example of navigating HAL APIs
<?php
// An example of navigating HAL enabled JSON APIs in Behat tests
// using https://github.com/tomphp/hal-client
use TomPHP\HalClient\Client;
class APIContext
{
// ...