Skip to content

Instantly share code, notes, and snippets.

View yorzi's full-sized avatar
🏠
Working from home

Andy Wang yorzi

🏠
Working from home
  • Xi'an, China
  • 20:03 (UTC +08:00)
View GitHub Profile
@yorzi
yorzi / write_deploy_log.rb
Created February 24, 2011 02:36 — forked from terrbear/write_deploy_log.rb
save the deploy log to server
alias :pputs :puts
def puts(str = "")
pputs(str)
$out << "#{str}"
end
STDOUT.instance_eval do
alias :pputs :puts
def puts(str = "")
pputs(str)
@yorzi
yorzi / gist:836679
Created February 21, 2011 05:11 — forked from xdite/gist:835829
MacBook 装机配置Rails的步骤

MacBook 裝機步驟

警告: 請絕對不要跳著裝!

系統套件

  • Software Update
  • Install Xcode ( Mac OS X Install CD 那一塊的 >> 選擇安裝)
@yorzi
yorzi / ruby-1.9-tips.rb
Created February 13, 2011 05:32 — forked from igrigorik/ruby-1.9-tips.rb
Ruby 1.9 Features and tips.
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@yorzi
yorzi / gist:769254
Created January 7, 2011 08:22 — forked from xdite/gist:758319
Ruby on Rails development Conventions

Rails 開發注意要點

About Ruby Syntax

  • 編輯器設定 soft tab (space=2),以 2 格空白符號做為程式內縮距離(不分語言)。
  • 函式如果只有一個參數,就不強制打()
  • 函式如果有二個以上的參數,通通都要有 ()
    • (避免發生奇怪的paser bug跟保持專案一致性)
  • 字串限定用雙引號包覆
  • 善用 "#{str1} #{str3} " 等字串改寫技巧取代不需要的字串加法。