Skip to content

Instantly share code, notes, and snippets.

View schmkr's full-sized avatar

Alwin Schoemaker schmkr

View GitHub Profile
@schmkr
schmkr / PrivateMethodCallerTrait
Created October 2, 2013 19:21
Get access to private methods (and properties), usefull for testing.
<?php
trait PrivateMethodCallerTrait {
protected function callPrivateMethod($object, $methodName, $args = array()) {
$fn = function($methodName, $args) {
return call_user_func_array(array($this, $methodName), $args);
};
$privateAccessor = $fn->bindTo($object,$object);
@schmkr
schmkr / Readme.md
Last active December 22, 2015 17:39
Example of Composer Satis with a deep SVN structure

Example of output when running:

bin/satis build satis.json ./web -vvv

Current output

Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Executing command (CWD): hg branch
Scanning packages
@schmkr
schmkr / smtp_catcher.php
Last active December 11, 2015 17:28
Script to catch mails on development machines
#!/usr/bin/env php
<?php
# create a filename for this email
list($ms, $time) = explode(' ', microtime());
$filename = '/tmp/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.txt';
# write the email contents to the file
$email_contents = fopen('php://stdin', 'r');
$fstat = fstat($email_contents);
@schmkr
schmkr / bash-history-top10.sh
Created January 14, 2013 09:31
List your bash history top 10
cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 10