- ルーチンの作り方に指針がない。
- どんな風にルーチンを構成するとよいルーチンになるのかがわからない。
- 抽象化という単語は知っているが、抽象化された状態がどんな状態なのかわからない。
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
private | |
def fixup(data) | |
return nil if ! data | |
return_data = output.isatty ? data : data.gsub(/\cM/,"") | |
if return_data.respond_to?(:force_encoding) | |
return_data.force_encoding('utf-8') if return_data.respond_to?(:force_encoding) | |
end | |
if running_on_windows? | |
begin |
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
<html> | |
<head> | |
</head> | |
<body> | |
<form id="input"> | |
<textarea id="list" rows="20" cols="30"></textarea> | |
<input type="button" value="run" onclick="quoteNumbers()"> | |
</form> | |
<pre id="result"> | |
</pre> |
ここに書いていく。
プログラミング入門
- なぜ JavaScript を学ぶのか ** 環境構築がいらない ** 言語として、利用領域としての将来性がある *** ブラウザはもちろんクライアントサイドは独壇場で一人勝ち *** 関数型プログラミングの要素 *** 関数がファーストクラスオブジェクト
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
RewriteRule ^ja/man/html/_A4CFA4B8A4E1A4CB.html(.*)$ http://doc.ruby-lang.org/ja/1.9.2/doc/spec=2fintro.html$1 [L,R=301] | |
RewriteRule ^ja/man/html/_A5B3A5DEA5F3A5C9.html(.*)$ http://doc.ruby-lang.org/ja/1.9.2/doc/spec=2fcommands.html$1 [L,R=301] | |
RewriteRule ^ja/man/html/Ruby_A4CEB5AFC6B0.html(.*)$ http://doc.ruby-lang.org/ja/1.9.2/doc/spec=2frubycmd.html$1 [L,R=301] | |
RewriteRule ^ja/man/html/-(.*)$ http://doc.ruby-lang.org/ja/-$1 [L,R=301] | |
RewriteRule ^ja/man/html/-(.*)$ http://doc.ruby-lang.org/ja/-$1 [L,R=301] | |
RewriteRule ^ja/man/html/_B4C4B6ADCAD1BFF4.html(.*)$ http://doc.ruby-lang.org/ja/1.9.2/doc/spec=2fenvvars.html$1 [L,R=301] | |
RewriteRule ^ja/man/html/-(.*)$ http://doc.ruby-lang.org/ja/-$1 [L,R=301] | |
RewriteRule ^ja/man/html/_A5AAA5D6A5B8A5A7A5AFA5C8.html(.*)$ http://doc.ruby-lang.org/ja/1.9.2/doc/spec=2fobject.html$1 [L,R=301] | |
RewriteRule ^ja/man/html/_A5AFA5E9A5B9.html(.*)$ http://doc.ruby-lang.org/ja/1.9.2/doc/spec=2fclass.html$1 [L,R=301] | |
RewriteRule ^ja/man/html/_BCC2B9D4.html(.*)$ http://doc.ruby-lan |
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 | |
// public ReflectionMethod::getClosure ( object $object ) alternative | |
function toClosure($class_name, $method_name, $obj = null) { | |
if (!is_null($obj) and !is_a($obj, $class_name)) throw new \InvalidArgumentException('invalid object is given.'); | |
$func = new ReflectionMethod($class_name, $method_name); | |
if ($func->isStatic()) { | |
return function() use($func) { | |
$func->invokeArgs(null, func_get_args()); | |
}; | |
} else { |
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 | |
// see https://gist.github.com/1106254 about toClosure() function. | |
class SpecificException extends Exception {}; | |
class Sample | |
{ | |
// Exectute Around Method and try-catch-finally sample in PHP. | |
function inLock($callback) { | |
$unlock = \toClosure(get_class(), 'unlock', $this); | |
$ensure = function() use($unlock) { $unlock(); }; | |
$this->lock(); |
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
// スゴロク | |
// Start Goal | |
// 0 -- 1 -- 2 -- 3 -- 4 | |
// dice! | |
// | |
// * 0 から 4 までのマスがあります | |
// * 0 から 2 のマスにいるとき、1 ターンにつき 1 進みます | |
// * 3 のマスにいるときは、サイコロを振り、1 か 6 のときのみ 1 進みます。 2 から 5 が出たときは 3 のマスへ残ったまま次のターンへ進みます | |
// * 4 まで来たらゴールなので、ゲームを終えます | |
// * ターンはループで回る一回を 1 ターンにします |