This file contains hidden or 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
irb(main):001:0> puts ENV['OS'] | |
Windows_NT |
This file contains hidden or 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
function assert( value, desc ) { | |
var output = value ? "Pass" : "Fail" | |
console.log("assert " + output , " => ", desc) | |
} | |
assert(1 == "1", "boolean") | |
assert(1 === "1", "boolean") |
This file contains hidden or 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
.zshrc | |
# screen で表示する時にタイトルにコマンドを表示する | |
preexec () { | |
if [ $TERM = "xterm" ]; then | |
echo -ne "\ek${1%% *}\e\\" | |
fi | |
} |
This file contains hidden or 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
respond_with で個別の処理をしたい場合 | |
respond_with(@user) do |format| | |
format.html { redirect_to users_url } | |
end | |
http://ryandaigle.com/articles/2009/8/10/what-s-new-in-edge-rails-default-restful-rendering |
This file contains hidden or 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
bundle update したら rspec のバージョンがあがってありがたいお言葉をもろた | |
Thank you for installing rspec-rails-2.0.1! | |
This version of rspec-rails only works with versions of rails >= 3.0.0 | |
To configure your app to use rspec-rails, add a declaration to your Gemfile. | |
If you are using Bundler's grouping feature in your Gemfile, be sure to include | |
rspec-rails in the :development group as well as the :test group so that you | |
can access its generators and rake tasks. |
This file contains hidden or 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
========== | |
検証 | |
========== | |
% cat mail.eml | |
Subject: hoge =?ISO-2022-JP?B?GyRCJUYlOSVIGyhC?= | |
Content-Type: text/plain; charset=ISO-2022-JP | |
Content-Transfer-Encoding: 7bit | |
sample | |
% rails c |
This file contains hidden or 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
// 要 jQuery | |
var to_native = function(type, str) { | |
if(type === "integer") { | |
return str-0 | |
} else if(type == "boolean") { | |
return !!str | |
} else if(type == "datetime") { | |
return new Date(Date.parse(str)) | |
} | |
return str |
This file contains hidden or 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
#!/bin/sh | |
# カレントディレクトリにある erb ファイルを haml へ変換して old ディレクトリに .erb ファイルを移すワンライナー | |
# zsh で動作確認済み | |
# 要 html2haml | |
for file in `ls`;do;html2haml ${file} ${file%erb}haml;mkdir -p old; mv ${file} old;done | |
# こっちは old に移さないで消す | |
# for file in `ls`;do;html2haml ${file} ${file%erb}haml;rm ${file};done |
This file contains hidden or 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
Pathname.glob("/tmp/**/*").select {|path| path.to_s =~ /\.txt\z/} |