Skip to content

Instantly share code, notes, and snippets.

View numbcoder's full-sized avatar
🎯
Focusing

Seekr Wang numbcoder

🎯
Focusing
View GitHub Profile
@numbcoder
numbcoder / gist:1287356
Created October 14, 2011 14:59 — forked from xdite/gist:758319
Ruby / Rails Convention of Techbang

Rails 開發注意要點

About Ruby Syntax

  • 編輯器設定 soft tab (space=2),以 2 格空白符號做為程式內縮距離(不分語言)。
  • 函式如果只有一個參數,就不強制打()
  • 函式如果有二個以上的參數,通通都要有 ()
    • (避免發生奇怪的paser bug跟保持專案一致性)
  • 字串限定用雙引號包覆
  • 善用 "#{str1} #{str3} " 等字串改寫技巧取代不需要的字串加法。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>COLORFUL</title>
<script src="/jquery-1.js" type="text/javascript" charset="utf-8"></script>
<script src="/modernizr.js" type="text/javascript" charset="utf-8"></script>
<script src="/mustache.js" type="text/javascript" charset="utf-8"></script>
<script>
@numbcoder
numbcoder / lawnchair-examples.js
Created March 16, 2011 01:16 — forked from brianleroux/lawnchair-examples.js
examples for using lawnchair js
// create a new store
var store = new Lawnchair({adaptor:'dom', table:'people'});
// saving documents
store.save({name:'brian'});
// optionally pass a key
store.save({key:'config', settings:{color:'blue'}});
// updating a document in place is the same syntax
@numbcoder
numbcoder / gist:764372
Created January 4, 2011 04:02 — forked from xdite/gist:758319
Rails 開發注意要點

Rails 開發注意要點

About Ruby Syntax

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