Skip to content

Instantly share code, notes, and snippets.

@kyontan
Created October 28, 2012 13:56
Show Gist options
  • Save kyontan/3968663 to your computer and use it in GitHub Desktop.
Save kyontan/3968663 to your computer and use it in GitHub Desktop.
Rubyちょこまか
# ロードパスにカレントディレクトリを追加
$:.unshift File.dirname(__FILE__)
or
require './hoge.rb'
#true になる物を全て返す
String#scan
#Mechanizeでauthの警告を出さない
agent.add_auth(URI("http://example.com"),"username","password")
#ファイル操作 (ブロックにした方がよい
s = open("bush.txt") {|f| f.read}
File.write("hoge.txt", s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment