Archive for February 1st, 2008
Tech at February 1st, 2008 by 小影
十年一覺程設夢
這一篇不推不行。好一個工程師!
我覺得, 工作除了賺錢, 還要有理想, 外帶對自我技術的提升,
看看自己的底限為何. 如果自己多花些時間, 從使用者的角度,
來改善產品品質, 幫 user 省錢. 而不是已交差了事的心態來做事.
當參與開發的產品能大賣時, 多分些 Bonus, 能獲得工程師最好的
工作滿足感跟合理報酬
Posted in Tech | 1 Comment »
ruby, tips at February 1st, 2008 by 小影
前文介紹過 irb ,它本身功能已很強大,但其實它還有自動完成的功能!也許是因為專家們都不用 auto completion 吧,預設值 ruby 是關掉了 auto completion的。
開啟 irb auto completion 的方法有三種:
1. 使用 irb 時用以下的 arguments:
irb -r irb/completion
2. 在 irb 裡用 require:
core siuying$ irb
irb(main):001:0> require 'irb/completion'
=> true
irb(main):002:0>
3. 在 ~/.irbrc 檔中加入以下一句:
require 'irb/completion'
效果是你可以輸入一些 keyword 再打 tab ,就有一堆候選字讓你選:
irb(main):005:0> c
callcc case cb ...
Posted in Tech | No Comments »
introduction, ruby at February 1st, 2008 by 小影
Ruby 其中一個好用的工具是 irb - Interactive Ruby。
它是一個 shell ,同時是 Ruby 的 environment。當你想要驗證一些想法時,你可以直接在 irb 中輸入 statement :
core siuying$ irb
irb(main):001:0> 5.times { puts "Hello!" }
Hi!
Hi!
Hi!
Hi!
Hi!
=> 5
想找第十個費布納西數列的數?
irb(main):002:0> x, y = 0, 1
irb(main):003:0> 10.times do
irb(main):004:1* puts y
irb(main):005:1> x, y = y, x + y
irb(main):006:1> end
1
1
2
3
5
8
13
21
34
你可以立即看到程式中的資料,甚至可以動態地改變物件的行為。比如說我們有這樣一個 class:
class Hello
def self.greet
...
Posted in Tech | No Comments »