This is a PHP microframework based on anonymous functions.
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 | |
| #Requires PHP 5.3.0 | |
| define("CONSUMER_KEY", "consumer_key"); | |
| define("CONSUMER_SECRET", "consumer_secret"); | |
| define("OAUTH_TOKEN", "access_token"); | |
| define("OAUTH_SECRET", "access_secret"); | |
| function oauth_gen($method, $url, $iparams, &$headers) { |
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 | |
| // extend base Stream class by checking stream meta data for remaining stream buffer before reading from blocking streams | |
| // heavily inspired by: https://github.com/clue/Worker/commit/8c6d7a4e733f0ee5aa431ffda1d4929229ae2336 | |
| class StreamUnblock extends \React\Stream\Stream | |
| { | |
| public function handleData($stream) | |
| { | |
| // check stream meta data for remaining buffer | |
| // yes, the manual explicitly says this value SHOULD NOT be used, |
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 | |
| // Let's see those errors! | |
| error_reporting(1); | |
| // Give it some time! | |
| set_time_limit(80); | |
| // File ext(types) to check! | |
| $check_files = 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
| <?php | |
| /* | |
| * HTTP/HTTPS class: simple HTTP client | |
| * - it's a wrapper for cURL, geared toward API/server-to-server call | |
| * - if you want to mimic a browser, you should NOT use these classes | |
| */ | |
| class HTTP { | |
| const SCHEME = 'http'; |
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 Worker | |
| { | |
| public function getCommand(); | |
| public function done($stdout, $stderr); | |
| public function fail($stdout, $stderr, $status); | |
| } |
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 | |
| $stdin = fopen('php://stdin', 'r'); | |
| $lines = array(); | |
| register_shutdown_function(function() use(&$lines) { | |
| $source = join("\n", $lines); |
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 extractByClass($class,$context){ | |
| preg_match_all('#<\s*(\w+)\s*class="\s*'.$class.'\s*"[^>]*>(.*?)</\s*\g1\s*>#sm',$context,$matches); | |
| return $matches[2]; | |
| } | |
| function extractByID($class,$context){ | |
| preg_match_all('#<\s*(\w+)\s*id="\s*'.$class.'\s*"[^>]*>(.*?)</\s*\g1\s*>#sm',$context,$matches); | |
| return $matches[2]; |
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 pre_print_r($var){ | |
| echo "<pre>"; | |
| print_r($var); | |
| echo "</pre>"; | |
| } | |
| function Bigrams($word){ |
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 StringBalance { | |
| private $startBrace = "("; | |
| private $endBrace = ")"; | |
| public $debug = false; | |
| private $startBraceFound; | |
| private $endBraceFound; |