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 | |
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
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 | |
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
/* | |
$ 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 | |
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
#!/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 | |
$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
The media type quality factor associated with a given type is determined by finding the media range with the highest precedence which matches that type. For example, | |
Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1, | |
text/html;level=2;q=0.4, */*;q=0.5 | |
would cause the following values to be associated: | |
text/html;level=1 = 1 | |
text/html = 0.7 | |
text/plain = 0.3 | |
image/jpeg = 0.5 |
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 | |
""" | |
Convert JSON data to human-readable form. | |
(Reads from stdin and writes to stdout) | |
""" | |
import sys | |
import json |