This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Emitter implements EmitterInterface { | |
| private $listeners = []; | |
| private $order = PHP_INT_MAX; | |
| public function on($event, callable $listener, $priority=0) | |
| { | |
| if (array_key_exists($event, $this->listeners) === false) { | |
| $this->listeners[$event] = new \SplPriorityQueue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Router implements RouterInterface { | |
| private $root; | |
| private $routes = []; | |
| public function __construct($root) { | |
| $this->root = $root; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class App { | |
| public $queue = []; | |
| public $routes = []; | |
| public $container; | |
| public $resolver; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace A; | |
| use A\Container\Builder as ContainerBuilder; | |
| class App { | |
| public $root; /** root directory given when initilizated */ | |
| public $container; /** an array-like object to retrieve services from */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| interface Logger { | |
| const CRITITAL = 50; | |
| const ERROR = 40; | |
| const WARNING = 30; | |
| const INFO = 20; | |
| const DEBUG = 10; | |
| /** Logs a message with integer level $level on this logger. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| ### LOADER ################################################################### | |
| include 'https://gist.githubusercontent.com/jm42/0bafdc8792c90bdec3a7/raw/c420e913bffd54878be2b23cda1e7ade6843d6ff/loader.php'; | |
| class PHPLoader extends Loader { | |
| public function load($resource) { | |
| include $resource; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function call_funcs(array $fns, array $args) { | |
| switch (true) { | |
| case empty($fns): return $args; | |
| case count($fns) === 1: return call_user_func_array($fns[0], $args); | |
| default: return call_user_func('call_funcs', array_slice($fns, 1), (array) call_user_func_array($fns[0], $args)); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Play Little Alchemy""" | |
| from selenium.webdriver import Firefox | |
| from selenium.webdriver.support.wait import WebDriverWait | |
| from selenium.webdriver.common.action_chains import ActionChains | |
| from selenium.common.exceptions import StaleElementReferenceException, \ | |
| MoveTargetOutOfBoundsException | |
| from os.path import join, dirname, abspath | |
| from time import sleep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env php | |
| <?php | |
| /** Documentation Generator | |
| * | |
| * Command line little script that given a PHP file name will generate an HTML | |
| * with it's documentation. | |
| */ | |
| function parse_doc($doc) { | |
| $lines = preg_split('#(\r\n|\n)#', $doc); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Settings extends Configurator implements \ArrayAccess { | |
| private $path; | |
| private $values; | |
| function __construct($path) { | |
| $this->path = $path; | |
| $this->values = []; | |
| } |