This file contains 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 | |
$hot_mess = | |
array( | |
5 => 5, | |
3 => array( | |
12, | |
12 => array( | |
'name' => 1 | |
), | |
32 => array( |
This file contains 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 | |
$hot_mess = | |
array( | |
5 => 5, | |
3 => array( | |
12, | |
12 => array( | |
'name' => 1 | |
), | |
32 => array( |
This file contains 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 get($base, $offset, $default = NULL) { | |
return (create_function('$base,$default', 'return isset($base' . $offset . ') ? $base' . $offset . ' : $default;'))($base, $default); | |
} |
This file contains 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 | |
/** | |
* Placeholder data type. | |
*/ | |
class _ {} | |
/** | |
* Implements partial application. | |
* |
This file contains 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
# CONKY | |
# A comprehensive conky script, configured for use on | |
# Ubuntu / Debian Gnome, without the need for any external scripts. | |
# | |
# Based on conky-jc and the default .conkyrc. | |
# INCLUDES: | |
# – tail of /var/log/messages | |
# – netstat connections to your computer | |
# | |
# — Pengo ([email protected]) |
This file contains 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 | |
ini_set('display_errors', 1); | |
error_reporting(E_ALL); | |
$request = microtime(TRUE); | |
function get($base, $offset, $default = NULL) { | |
$func = create_function('$base, $default', 'return isset($base' . $offset . ') ? $base' . $offset . ' : $default;'); | |
return $func($base, $default); | |
} | |
$get_results = array(); | |
for($i = 0 ;$i<100000;$i++) { |
This file contains 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 _ {} | |
function get($data, array $offsets, $default, $lens = 'prop') { | |
$results = call_user_func(call_user_func_array('pipe', array_map(function($offset) use($lens){ | |
return partial($lens, (new _), $offset); | |
},$offsets)), $data); | |
return is_a($results, '_') ? $default : $results; | |
} | |
function partial(callable $fn, ...$start) { | |
return function (...$args) use ($fn, $start) { |
This file contains 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 _ {} | |
function compose(callable $fn, ...$start) { | |
return pipe($fn, ...array_reverse($start)); | |
} | |
function filter(callable $fn, $data) { | |
return array_filter((array)$data, function ($v, $k) use ($fn, $data) { | |
return $fn($v, $k, $data); | |
}, ARRAY_FILTER_USE_BOTH); | |
} |
This file contains 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 | |
/** | |
* Data type to signify a placeholder. | |
*/ | |
class PlaceHolder {} | |
class_alias('PlaceHolder', '_'); | |
/** | |
* Recursive array filter. | |
* |
This file contains 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 | |
/** | |
* Data type to signify a placeholder. | |
*/ | |
class PlaceHolder {} | |
class_alias('PlaceHolder', '_'); | |
/** | |
* Recursive array filter. | |
* |