Skip to content

Instantly share code, notes, and snippets.

Mathias Verraes mathiasverraes

Block or report user

Report or block mathiasverraes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mathiasverraes / flatten.php
Last active Aug 29, 2015
simple way to flatten an array
View flatten.php
function flatten(array $array)
return call_user_func_array('array_merge', $array);
View ValueObjectAllTheThings:RomanNumeralEdition!.php
final class Number // Immutable value object
* @param int $arabic
* @throws InvalidArgumentException
public function __construct($arabic) { /* ... */ }
# === Initializing static variables ===========================================
case $TERM in
xterm* | screen)
mathiasverraes / example.erl
Last active Aug 29, 2015
event sourced aggregate
View example.erl
History1 = order:add_orderline([], 15).
History2 = order:add_orderline(History1, 50).
History3 = order:pay_for_order(History2, 20).
% ** exception throw: {payment_amount_is_too_small,{price,65}}
History3 = order:pay_for_order(History2, 65).
View Authorization.cs
public class AuthorizationSpecifications
public void WhoAreYouGonnaCall()
new AuthorizationScenario().
mathiasverraes / implementation.php
Last active Aug 29, 2015
More functional experiments
View implementation.php
define('map', 'map');
function map($collection, $fn) { return array_map($fn, $collection); }
define('fold', 'fold');
function fold($collection, $fn, $initial) { return array_reduce($collection, $fn, $initial); }
define('filter', 'filter');
function filter($collection, $fn) { return array_filter($collection, $fn);}
function compose(array $collection, $fn, $args)
View gist:f7dcb2b4c24485a3b9c9
### Keybase proof
I hereby claim:
* I am mathiasverraes on github.
* I am mathiasverraes ( on keybase.
* I have a public key whose fingerprint is 3BCD D69A 3CBA E8EE 380A BA63 C938 C231 E989 3D78
To claim this, I am signing this object:
View Basket.php
final class Basket implements RecordsEvents
private $basketCanOnlyContainFiveProducts;
private function __construct()
$this->basketCanOnlyContainFiveProducts = new BasketCanOnlyContainFiveProducts();
mathiasverraes / gist:b557d4013718a905d8b7
Created Aug 15, 2014
The Little Schemer continuation example ported to Erlang
View gist:b557d4013718a905d8b7
a_friend(_, []) -> false;
a_friend(_, _) -> true.
main() ->
multiremberco(tuna, [strawberries, tuna, swordfish], fun a_friend/2).
multiremberco(_Atom, [], Cont) ->
View currying.php
require_once __DIR__ . '/../src/Verraes/Lambdalicious/load.php';
// non generic, only deals with functions with arity=2
function curry($f) {
return function($x) use($f) {
return function($y) use($f, $x) {
return $f($x, $y);
You can’t perform that action at this time.