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 | |
// ポート8080の場合、ショートカットのリンク先 C:\php5.4\php.exe -S 127.0.0.1:8080 built-in-server.php | |
// 作業フォルダにドキュメントルートを入力して起動 | |
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); | |
if (strcmp('/', $path) !== 0) { | |
if (file_exists(realpath(__DIR__ . $path))) { | |
return false; | |
} | |
} | |
require __DIR__ . DIRECTORY_SEPARATOR . 'index.php'; |
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
# 履歴保存 | |
option savehist C:\Applications\NYAOS\.history | |
# %USERPROFILE%\_nya に以下を追記して読み込む | |
source %USERPROFILE%\Dropbox\AppData\NYAOS\_nya_prompt.lua | |
# Gitコマンド | |
alias git C:\Applications\Git\bin\git.exe |
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 apps/04-rest/htdocs/dev.php get /http/googlenews | |
[1;32m[CODE][0m500 Internal Server Error | |
[1;32m[HEADER][1;33m X-EXCEPTION [0mException | |
[1;32m[HEADER][1;33m X-EXCEPTION-CODE [0m0 | |
[1;32m[HEADER][1;33m X-EXCEPTION-MESSAGE [0mView C:\Users\k_horii\Documents\Projects\BEAR\BEAR.Sunday\apps\04-rest\Page\http/view/GoogleNews.hng doesn't exists | |
[1;32m[HEADER][1;33m 0 [0mX-Request-Per-Second: 0 | |
[1;32m[HEADER][1;33m 1 [0mX-Memory-Peak-Usage: 3,145,728 | |
[1;32m[BODY][0m | |
<div class="trace">#0 C:\Users\k_horii\Documents\Projects\BEAR\BEAR.Sunday\packages\BEAR.Framework\src\Link\View\Haanga.php(48): Haanga::Load('C:\Users\k_hori...', Array, true) | |
#1 [internal function]: restWorld\Page\Http\GoogleNews->onLinkView(Object(restWorld\Page\Http\GoogleNews)) |
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 | |
set_error_handler(function($errno, $errstr, $errfile, $errline){ | |
$titles = array ( | |
E_ERROR => 'Fatal error', | |
E_WARNING => 'Warning', | |
E_NOTICE => 'Notice', | |
E_STRICT => 'Strict standards', | |
E_RECOVERABLE_ERROR => 'Catchable fatal error', | |
E_DEPRECATED => 'Depricated', | |
); |
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 | |
return array( | |
array('name' => 'Abe' , 'score' => 800), | |
array('name' => 'Oda' , 'score' => 1000), | |
array('name' => 'Hosokawa', 'score' => 600), | |
); |
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 | |
session_start(); | |
// コネクションプールにサーバ追加。必要な時に自動接続、スクリプト終了時に自動切断される。 | |
$memcache = new Memcache(); | |
$memcache->addServer('localhost', 11211); | |
$keys = range(0, 10000); | |
$items = array_combine($keys, |
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 | |
set_time_limit(60); | |
session_start(); | |
$keys = range(0, 100000); | |
//----------------------------------------------------------------------------- | |
$host = 'localhost'; |
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 | |
assert_options(ASSERT_ACTIVE, 1); | |
assert_options(ASSERT_WARNING, 0); | |
assert_options(ASSERT_CALLBACK, function ($file, $line) { | |
echo '<pre>' . htmlspecialchars(sprintf("Assertion Failed: at %s[%d]\n", $file, $line)) . '</pre>'; | |
}); | |
assert(array('1', 'foo"') == str_getcsv("1\t\"foo\"\"", "\t", '"')); // OK | |
assert(array('1', 'foo"') == str_getcsv("1\t\"foo\\\"", "\t", '"', '\\')); // NG | |
// なぜなの… |
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 | |
namespace Acme; | |
set_include_path(implode(PATH_SEPARATOR, array( | |
'/path/to/pear', | |
'/path/to/vendor', | |
get_include_path(), | |
))); | |
spl_autoload_register(function($className) { |
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 | |
return function($className) { | |
$className = ltrim($className, '\\'); | |
if (false !== ($pos = strrpos($className, '\\'))) { | |
$namespace = substr($className, 0, $pos); | |
$className = substr($className, $pos + 1); | |
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) | |
. DIRECTORY_SEPARATOR | |
. str_replace('_', DIRECTORY_SEPARATOR, $className); | |
} else { |