Skip to content

Instantly share code, notes, and snippets.

View jubianchi's full-sized avatar
🏳️‍🌈
nyan nyan nyan

Julien BIANCHI jubianchi

🏳️‍🌈
nyan nyan nyan
View GitHub Profile
<?php
namespace {
class A {}
var_dump(class_alias('A', 'B')); // => bool(true)
$reflector = new \ReflectionClass('B');
var_dump($reflector->getName()); // => string(1) "A"
}
namespace jubianchi\Alias {
{
"name": "atoum-praspel",
"type": "script",
"description": "",
"authors": [
{
"name": "Julien Bianchi",
"email": "contact@jubianchi.fr",
"homepage": "http://jubianchi.fr"
}
@jubianchi
jubianchi / 00_test.php
Last active December 17, 2015 14:09
AOP-PHP compilation under OS X 10.8.3 with PHP 5.4.11
<?php
aop_add_before('printf()', function($jp) {
echo 'Hey, I\'m being magically called before printf !' . PHP_EOL;
});
aop_add_after('printf()', function($jp) {
echo 'AOP-PHP is really awesome !' . PHP_EOL;
});
aop_add_around('date()', function($jp) {
@jubianchi
jubianchi / usage.sh
Last active December 15, 2015 12:59
# Start your VM either manually or using vboxmanage
#
# /!\ The VM has to be started in non-headless mode for this script to work
# When you want to make it headless (dettached window) use
$ vboxsw "VM Name" d
# When you want to get the window back use
$ vboxsw "VM Name" a
@jubianchi
jubianchi / .atoum.treemap.php
Created March 27, 2013 11:44
This has to be improved (really !) with a real complexity computing algorithm
<?php
use
mageekguy\atoum\scripts\treemap,
mageekguy\atoum\scripts\treemap\analyzers,
mageekguy\atoum\scripts\treemap\categorizer
;
$testsDirectory = __DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR;
@jubianchi
jubianchi / .gitconfig
Last active December 14, 2015 15:29
git stashstash
[alias]
stashstash = "!f() { STASH=$(git stash); echo \"\\033[0;31mKouroukoukou roukoukou stash stash\\033[0m\"; echo \"$STASH\"; xdg-open \"http://www.youtube.com/watch?v=LpE1bJp8-4w&feature=youtu.be&t=47s\" > /dev/null 2>&1 & }; f"
satsh = !git stashstash
<?php
namespace jubianchi {
class foo {
public function __construct($foo, $bar) {
echo $foo . '-' . $bar;
}
}
}
namespace tests\units\jubianchi {
@jubianchi
jubianchi / gist:4353155
Last active December 10, 2015 00:39 — forked from anonymous/gist:4353149
<?php
namespace foo {
interface client
{
public function execute($query, array $params);
}
@jubianchi
jubianchi / ControllerTest.php
Last active December 9, 2015 22:18 — forked from anonymous/ControllerTest.php
This is an example usage of the AtoumBundle RFC with an improved syntax matching atoum's standards. https://github.com/atoum/AtoumBundle/pull/8 https://github.com/atoum/AtoumBundle/issues/15
<?php
namespace Acme\DemoBundle\Tests\Controller;
require_once __DIR__ . '/../../../../vendor/autoload.php';
require_once __DIR__ . '/../../../../vendor/atoum/atoum/scripts/runner.php';
use atoum\AtoumBundle\Test\Controller;
class DemoController extends Controller\ControllerTest
{
<?php
use \mageekguy\atoum;
function colorized() {
$color = -1;
if(false !== ($term = getenv('TERM'))) {
if(preg_match('/\d+/', $term, $matches) > 0) {
$color = $matches[0];
}
}