Skip to content

Instantly share code, notes, and snippets.

View mbfisher's full-sized avatar

Mike Fisher mbfisher

  • GoCardless
  • London
View GitHub Profile
@mbfisher
mbfisher / prepare-revolut-statement.py
Last active December 2, 2019 15:59
Revolut Statement
import csv
import sys
from datetime import datetime
fields = ['Date completed', 'Description', 'Amount', 'Balance']
data = []
with open(sys.argv[1], encoding="utf-8-sig") as csvfile:
reader = csv.DictReader(csvfile)
@mbfisher
mbfisher / keybase.md
Last active July 16, 2018 22:58
Keybase

Keybase proof

I hereby claim:

  • I am mbfisher on github.
  • I am mbfisher (https://keybase.io/mbfisher) on keybase.
  • I have a public key ASCZLo9Z9OjS2OfqFb50eyedCya6xHOKd8sTk79pttjN3Qo

To claim this, I am signing this object:

<?php
require 'vendor/autoload.php';
class Transformer extends League\Fractal\TransformerAbstract
{
protected $availableIncludes = ['child'];
protected $defaultIncludes = ['child'];
public function transform($data)
@mbfisher
mbfisher / gist:a7f2a865cadb69f1afc3
Last active August 29, 2015 14:01
Simple Elasticsearch interaction
<?php
require 'vendor/autoload.php';
$client = new Elasticsearch\Client([
'hosts' => ['127.0.0.1']
]);
echo "Resetting...\n";
$index = ['index' => 'freedomclinics.com'];

Tables

Work on a table:

$table = $this->table('table_name');

To commit changes in an up or down method:

@mbfisher
mbfisher / phpunit.rst
Last active December 28, 2015 23:49
PHPUnit Cheatsheet

Run a test suite; phpunit -c path/to/phpunit.xml --testsuite ${name}

getMockBuilder

setMethods(array $methods) can be called on the Mock Builder object to specify the methods that are to be replaced with a configurable test double. The behavior of the other methods is not changed. If you call setMethods(NULL), then no methods will be replaced.

setConstructorArgs(array $args) can be called to provide a parameter array that is passed to the original class' constructor (which is not replaced with a dummy implementation by default).

setMockClassName($name) can be used to specify a class name for the generated test double class.

@mbfisher
mbfisher / git.rst
Last active December 28, 2015 00:08
Git Cheatsheet

Branches

Tracking

Show tracking git branch -vv

Set up on existing local branch or change tracked remote branch git branch -u $remote/$branch [$local]