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 | |
nth($what = 2, $loop = 'default') { | |
static $loops = array(); | |
return ($loops[$loop] % $what == 0); | |
} |
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 mod_querystring($name, $value = NULL) { | |
$vars = $_GET; | |
$vars[$name] = $value; | |
return http_build_query($name); | |
} | |
print http_build_query(array('hej'=>'tjo', 'hepp'=>'happ','haha' => NULL)); |
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 split_chunks($input) { | |
$offset = 0; | |
foreach(array_slice(func_get_args(), 1) as $length) { | |
$out[] = substr($input, $offset, $length); | |
$offset += $length; | |
} | |
return $out; | |
} |
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 MobWrite { | |
protected $user = 0; | |
protected $file = NULL; | |
protected $datastore; | |
protected $diffengine; | |
public function __construct($datastore, $diffengine) { | |
$this->datastore = $datastore; | |
$this->diffengine = $diffengine; |
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 MobWritePatcher($text, $patch) { | |
$pointer = 0; | |
foreach(explode("\t", $patch) as $step) { | |
$modifier = substr($step, 0, 1); | |
$argument = substr($step, 1); | |
switch($modifier) { | |
case '=': |
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 array_flatten(Array $array, Array $out = array()) { | |
foreach($array as $value) | |
is_array($value) ? $out = array_flatten($value, $out) : $out[] = $value; | |
return $out; | |
} |
NewerOlder