Skip to content

Instantly share code, notes, and snippets.

View mathiasverraes's full-sized avatar

Mathias Verraes mathiasverraes

View GitHub Profile
@mathiasverraes
mathiasverraes / phplint.sh
Created July 12, 2012 07:42
Recursive PHP Lint script
#!/bin/bash
for file in `find .`
do
EXTENSION="${file##*.}"
if [ "$EXTENSION" == "php" ] || [ "$EXTENSION" == "phtml" ]
then
RESULTS=`php -l $file`
@mathiasverraes
mathiasverraes / gist:b6673d1a1e010b2db0db46ac11eb80c8
Created April 23, 2018 10:21 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@mathiasverraes
mathiasverraes / fseu.php
Created October 7, 2022 09:36
Output of my live coding impro at Full Stack Europe 2022
<?php declare(strict_types=1);
// @mathiasverraes
// parser is a function that takes some input and returns (either (structured value AND remainder) OR error)
// parser is a function that takes some input and returns a Result
$a = function ($input) {
$parsed = substr($input, 0, 1);
$remainder = substr($input, 1);
if ($parsed === 'a') return succeed($parsed, $remainder); else return fail("expected a");
};
@mathiasverraes
mathiasverraes / .bashrc
Created November 3, 2011 18:46 — forked from thomasvm/.bashrc
Git shortcuts
#! /bin/sh
alias gs="git status"
alias gc="git commit"
alias gr="git checkout"
alias ga="git add"
alias gl="git lola"
@mathiasverraes
mathiasverraes / TestFrameworkInATweet.php
Last active May 23, 2022 12:28
A unit testing framework in a tweet.
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}

My kid 11yo has a blood phobia. I asked Twitter for suggestions for action/adventure/scifi/fantasy/comedy movies that are suitable for a 9 and 11 yo who like Star Wars and Back to the Future.

Below are the movies people have suggested. They often did so from memory, and I haven't validated if they are indeed suitable. However, I learned about this site where you can lookup if a moview has blood or other phobia-inducing content: https://www.doesthedogdie.com/

Has no blood

@mathiasverraes
mathiasverraes / zeromq.md
Last active September 23, 2021 13:29
zeromq php7
git clone git://github.com/mkoppanen/php-zmq.git
cd php-zmq
phpize && ./configure
make && make install

Finally add the following line to your php.ini:

@mathiasverraes
mathiasverraes / rollyourown.php
Created May 30, 2018 14:17
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
@mathiasverraes
mathiasverraes / .gitconfig
Created January 10, 2013 20:39
Bart's Pimping Git Log
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
@mathiasverraes
mathiasverraes / ExcelTest.php
Created September 26, 2020 21:43
Parsica excel example
<?php declare(strict_types=1);
/*
* This file is part of the Parsica library.
*
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/