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
{ | |
"require": { | |
"donatj/cli-toolkit": "dev-master" | |
} | |
} |
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 | |
// config | |
define("DEBUG", true); | |
// loading | |
if(DEBUG) | |
include('/path/to/psysh'); | |
// setup | |
set_error_handler(function($errno, $errstr, $errfile, $errline){ |
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 | |
$foo = 'ふー'; | |
$bar = 'ばー'; | |
$func1 = generate($foo,$bar); | |
// $app->get($key, generate($foo, $bar)); | |
$foo = "FOOO!!!"; |
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 world { | |
public $v; | |
public function main(){ | |
$this->v = 'じゃばい'; | |
$f = function(){ | |
echo $this->v; | |
}; |
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 Guard{ | |
public $destruct; | |
public function __construct($callable){ | |
$this->destruct = $callable; | |
} | |
public function __destruct(){ | |
call_user_func($this->destruct); | |
} | |
} |
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 | |
/** | |
* ThumbnailImageMaker | |
* | |
* require GD | |
* | |
* @author Junichi Ishida <[email protected]> | |
* @license MIT License | |
* @version v0.0.1 |
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 Mother { | |
static $html = ' | |
<html> | |
<body> | |
{{content}} | |
</body> | |
</html> | |
'; | |
public function __construct($my_name=null, $var=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 | |
$pattern = '/test/:id/'; | |
$regexPattern = preg_replace_callback( | |
'#:([\w]+)#', | |
function($m){ | |
return '(?P<'.$m[1].'>[^/]+)'; | |
}, | |
$pattern | |
); |
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
public function getRemoteIP(){ | |
$_SERVER_UC = array_change_key_case($_SERVER, CASE_UPPER); | |
if(isset($_SERVER_UC['HTTP_CLIENT_IP'])) | |
return $_SERVER_UC['HTTP_CLIENT_IP']; | |
if(isset($_SERVER_UC['HTTP_X_CLUSTER_CLIENT_IP'])) | |
return $_SERVER_UC['HTTP_X_CLUSTER_CLIENT_IP']; | |
if(isset($_SERVER_UC['HTTP_FORWARDED_FOR'])) | |
return $_SERVER_UC['HTTP_FORWARDED_FOR']; |
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
基本的にはemlフォーマット(メールのソースである) | |
改行コードはどうやらLFである | |
一行目にメールソースの長さが入る、 | |
つまり後述のXMLが開始するまでのバイト数、ただし先頭の数字(サイズ)の行を除く | |
なので、ボディサイズをいきなりカウントして、 | |
その数字を先頭にいれて、ボディをいれて、XMLをつっこめばよい。 |