Skip to content

Instantly share code, notes, and snippets.

@cofemei
cofemei / gist:758359
Created December 29, 2010 09:17 — forked from xdite/gist:758319

Rails 開發注意要點

About Ruby Syntax

  • 編輯器設定 soft tab (space=2),以 2 格空白符號做為程式內縮距離(不分語言)。
  • 函式如果只有一個參數,就不強制打()
  • 函式如果有二個以上的參數,通通都要有 ()
    • (避免發生奇怪的paser bug跟保持專案一致性)
  • 字串限定用雙引號包覆
  • 善用 "#{str1} #{str3} " 等字串改寫技巧取代不需要的字串加法。
@cofemei
cofemei / cap
Created December 8, 2010 08:03
set :default_stage, "staging"
default_run_options[:pty] = true
set :rails_env, default_stage
set :application, app_name_#{rails_env}
set :deploy_to, "/u/apps/#{application}_#{rails_env}"
set :domain, server_name
set :repository, repo_url
set :use_sudo, false
set :scm, :git
set :branch, "master"
@cofemei
cofemei / app.rb
Created March 15, 2010 12:52 — forked from bigcurl/app.rb
Sinatra on Google AppEngine For Windows
require 'rubygems'
require 'sinatra'
get '/' do
"Hello from Sinatra running on Java!"
end