Skip to content

Instantly share code, notes, and snippets.

Benjamin Eberlei beberlei

Block or report user

Report or block beberlei

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
beberlei / .block
Last active Aug 28, 2018 — forked from mbostock/.block
Bar Chart
View .block
license: gpl-3.0
beberlei / phpunit_php7.patch
Last active Aug 29, 2015
PHPUnit necessary chanegs for PHP7 Coercive Typehints
View phpunit_php7.patch
diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php
index 1b3b339..71ee4a9 100644
--- a/src/Framework/TestSuite.php
+++ b/src/Framework/TestSuite.php
@@ -878,7 +878,11 @@ public static function isTestMethod(ReflectionMethod $method)
// @scenario on TestCase::testMethod()
// @test on TestCase::testMethod()
- $doc_comment = $method->getDocComment();
+ $doc_comment = (string)$method->getDocComment();
View loop.php
$products = array();
foreach($arr['accounts'] as $val) {
$account_id = $val['account_id'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, ''.$account_id.'/sales?break_down=product&start_date=2015-01-01&end_date=2015-01-31');
View arguments_xhprof.php
$options = array(
'argument_functions' => array(

Dependency "watchr":

sudo gem install watchr

On Macs:

sudo gem install growl

Uses notify-send on other systems than Mac.

View datemanip.php
function datemanip(DateTime $dt)
return $dt->modify("+2 day");
$dt = new DateTime();
$dti = new DateTimeImmutable();
beberlei /
Created Dec 4, 2012 — forked from piscisaureus/
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

beberlei / tailrecursion.php
Created Nov 25, 2012 — forked from pkriete/gist:2425817
PHP Tail Recursion
View tailrecursion.php
class TailRecursion
public $func;
public $acc;
public $recursing;
public function tail()
return call_user_func_array($this->func, func_get_args());
beberlei / CommandMethodMapper.php
Created Nov 24, 2012
Symfony Form DataMapper that uses a command method to write data back on object
View CommandMethodMapper.php
* This file is part of the Symfony package.
* (c) Fabien Potencier <>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
beberlei / .deployment
Created Nov 19, 2012
Composer on Azure Websites
View .deployment
command = "D:\Program Files (x86)\PHP\v5.3\php.exe" build_azure.php
You can’t perform that action at this time.