Moved to https://github.com/ucnv/diff-for-gist.github. This script is also available at .
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 |
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 | |
$array = new SplFixedArray($size); | |
$array[0] = 'foo'; | |
$array[1] = 'bar'; | |
... | |
$array[100000] = 'baz'; | |
?> |
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 | |
$interval = DateInterval::createFromDateString("1 hour"); | |
$dateTime->add($interval); | |
echo $dateTime->format(DateTime::ATOM); // 2012-09-01T23:20:01+01:00 | |
?> |
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 | |
$good_salt = '$2y$10$22randomcharactershere$'; | |
$logged_in = false; | |
if (strpos($stored_password, '$2a$') === 0) { | |
$bad_hash = '$2x$' .substr($stored_password, 4); | |
if (crypt($input_password, $bad_hash) == $bad_hash)) { | |
// generate a new password |
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 ClassName { | |
function foo() | |
{ | |
echo __METHOD__, PHP_EOL; | |
} | |
function bar() | |
{ | |
echo __METHOD__, PHP_EOL; |
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 Bar { | |
public function A() | |
{ | |
echo __METHOD__, PHP_EOL; | |
} | |
private function B() | |
{ | |
echo __METHOD__, PHP_EOL; |
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/external/footer.php b/external/footer.php | |
index 0bd5e30..c6fa5da 100755 | |
--- a/external/footer.php | |
+++ b/external/footer.php | |
@@ -4,7 +4,7 @@ if (extension_loaded('xhprof') && $_xhprof['doprofile'] === true) { | |
$xhprof_data = xhprof_disable(); | |
$xhprof_runs = new XHProfRuns_Default(); | |
$run_id = $xhprof_runs->save_run($xhprof_data, $profiler_namespace, null, $_xhprof); | |
- if ($_xhprof['display'] === true) | |
+ if ($_xhprof['display'] === true && PHP_SAPI != 'cli') |
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 | |
for ($j = 1; $j < 10000000; $j = $j) { | |
$size = $j; | |
echo $size . " elements" . PHP_EOL; | |
$start = microtime(true); | |
for($i = 0; $i < $size; $i++) { | |
// do nothing | |
$array[$i] = new stdClass(); |
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 | |
for ($j = 1; $j < 10000000; $j = $j) { | |
$size = $j; | |
echo $size . " elements" . PHP_EOL; | |
$start = microtime(true); | |
for($i = 0; $i < $size; $i++) { | |
// do nothing | |
$array[$i] = new stdClass(); |