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 camelize($name) { | |
| return strtr(ucwords(strtr($name, array('_' => ' ', '-' => '_ ', '.' => '_ ', '\\' => '_ '))), array(' ' => '')); | |
| } | |
| class Container implements \ArrayAccess { | |
| protected $container = []; | |
| function offsetSet($key, $value) { |
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
| # Hay 1000 lamparitas numeradas del 1 al 1000, las que son numeros primos | |
| # tienen un interruptor que cambia el estado de la lamparita de el y de | |
| # todos sus multiplos. | |
| # Cual es el maximo de lamparitas que pueden haber prendidas? | |
| #def divisores(n): | |
| # d = [] | |
| # for i in range(1, n + 1): | |
| # if n % i == 0: | |
| # d.append(i) |
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 ConflictException extends \Exception {} | |
| class Configurator extends \SplPriorityQueue { | |
| private $order = PHP_INT_MAX; | |
| function insert($path, $key, callable $fn, $priority=0) { | |
| parent::insert([$key, $fn], [$priority, $path, --$this->order]); | |
| } |
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 Configurator extends \SplPriorityQueue { | |
| private $order = PHP_INT_MAX; | |
| function insert($path, $key, callable $fn, $priority=0) { | |
| parent::insert([$key, $fn], [$priority, $path, --$this->order]); | |
| } | |
| // [...] |
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 = []; | |
| } |
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
| """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
| <?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
| <?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 | |
| 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. |