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 | |
| $pdo = new PDO("mysql:host=HOSTNAME", "USERNAME", "PASSWORD"); | |
| $query = $pdo->prepare("SHOW DATABASES"); | |
| $query->execute(); | |
| foreach ($query->fetchAll(PDO::FETCH_OBJ) as $row) { | |
| $db = $row->Database; | |
| echo "= $db =" . PHP_EOL; | |
| $pdo->exec("USE $db"); |
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 python | |
| """ | |
| Highlight stdin using pygments and output to stdout | |
| Re-uses httpie. | |
| Auto-detects the input language. | |
| Will not colorize if piped into something else. |
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 Registry { | |
| /** | |
| * @var array The store for all objects | |
| */ | |
| static private $store = array(); | |
| /** |
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
| /* | |
| $ http GET https://api.github.com/users/dshafik/repos | |
| HTTP/1.1 200 OK | |
| Server: nginx/1.0.13 | |
| Date: Wed, 25 Apr 2012 01:57:50 GMT | |
| Content-Type: application/json; charset=utf-8 | |
| Transfer-Encoding: chunked | |
| Connection: keep-alive | |
| Status: 200 OK | |
| X-RateLimit-Limit: 5000 |
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 _urlSimilartor($url) | |
| { | |
| //This is an example | |
| $url = preg_replace("/[0-9]+/", "XXX", $url); | |
| $qs = parse_url($url, PHP_URL_QUERY); | |
| if ($qs) { | |
| $parts = array(); | |
| parse_str($qs, $parts); |
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
| source $HOME/.bash_completion/git-completion.bash | |
| GIT_PS1_SHOWDIRTYSTATE=1 | |
| GIT_PS1_SHOWUPSTREAM="auto" | |
| PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \[\033[1;31m\]$(__git_ps1 "(%s) ")\[\033[1;37m\]\$\[\033[00m\] ' |
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 | |
| date_default_timezone_set("America/New_York"); | |
| function gen() { | |
| $i = 0; | |
| while (true) { | |
| file_put_contents("./log", | |
| date("Y-m-d H:i:s") .' '. | |
| (yield $i++) . ' ' . | |
| PHP_EOL | |
| , FILE_APPEND); |
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
| diff --git a/runkit.c b/runkit.c | |
| index 67c487b..4a15711 100644 | |
| --- a/runkit.c | |
| +++ b/runkit.c | |
| @@ -142,7 +142,7 @@ zend_module_entry runkit_module_entry = { | |
| PHP_RSHUTDOWN(runkit), | |
| PHP_MINFO(runkit), | |
| #if ZEND_MODULE_API_NO >= 20010901 | |
| - PHP_RUNKIT_VERSION, | |
| + PHP_RUNKIT_VERSION, |
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 Application; | |
| use Zend\Mvc\ModuleRouteListener; | |
| use Zend\Mvc\MvcEvent; | |
| class Module { | |
| public function onBootstrap(MvcEvent $e) | |
| { | |
| $eventManager = $e->getApplication()->getEventManager(); |
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 | |
| if (!isset($_SERVER['argv'][1])) { | |
| echo "Usage: {$_SERVER['argv'][0]} <filename>" . PHP_EOL; | |
| exit; | |
| } | |
| $tokens = token_get_all(file_get_contents($_SERVER['argv'][1])); | |
| foreach ($tokens as $token) { | |
| if (is_integer($token[0])) { |