Write Maintainable Css

今天看了CSS guideline描述在大型專案如何撰寫容易維護的CSS,我直接從翻譯過文章摘錄了其中覺得還不錯而且執行上也不會太困難的幾點記下來讓自己隨時能夠複習

Continue reading →
css

Shell Script on Linux

前陣子用linux shell script寫了module自動deploy機制。紀錄一下這之中遇到的問題及常用的指令。
簡單的自動deploy不外乎就是將檔案傳送至遠端機器然後進行安裝動作,修改設定檔。

  • login to remote server

Continue reading →

Hello Octopress

真的是好久沒寫blog了。看了一下最後一篇是在3月2日已經整整4個月沒寫了。

markdown的語法也都快忘光了:(一開始執行rake new_post時還發生錯誤無法產生新文章,快速地google了一下原來是dependency太舊的關係,執行完bundle update就OK了真是好險啊。 前陣子使用emberjs發現了一些之前沒注意到的細節。

Continue reading →

Ruby Is Elegance

今天持續Ruby study,紀錄一下學習到的東西

Yield

讓自定義的method可以接受block, 在yield之後的code會等block內容跑完才接著跑

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def block_test
  puts "We're in the method!"
  puts "Yielding to the block..."
  yield
  puts "We're back in the method!"
end

block_test { puts ">>> We're in the block!" }

#you can pass parameter too
def yield_name(name)
  puts "In the method! Let's yield."
  yield name
  puts "Block complete! Back in the method."
end

yield_name("samuel") { |a| puts "My name is #{a}."}

The output is

We're in the method!
Yielding to the block...
>>> We're in the block!
We're back in the method!

In the method! Let's yield.
My name is samuel.
Block complete! Back in the method.
Continue reading →

Ruby Study

最近都在看CSS沒什麼時間繼續看Ruby,今天上codecademy練習ruby。 在這裡紀錄一下之前沒看過的語法。

Multiple comments

1
2
3
4
=begin
this is comment,
i am comment too.
=end

Get input from console

1
2
print "Integer please: "
user_num = Integer(gets.chomp)
Continue reading →

Ruby Beginning

前幾天開始看Ruby起因是網路上很多分享的project都是Rails,為了能夠加速了解理面的內容就來學一下Rails, 不過為了Rails必須要先打好Ruby的基礎。在這裡紀錄下學習過的語法避免自己忘光,光是昨天沒看語法我已經忘了不少XD。

Continue reading →

Emberjs and I18n

這兩天試了emberjs的i18n方法,有了一點小心得在這裡紀錄一下。 一開始google下去找到的就是jamesarosen這個ember i18n library。 library裡面有介紹CLDR.js這個library,主要是處理不同語言間名詞數量的問題。 當然你可以單獨使用i18n library,也可以搭配CLDR.js。 請參考CLDR plural 規範

Continue reading →

Sublime Useful Plugin

今天上班跟同事之間討論到共同開發module要不要限定什麼editor(因為寫javascript), 就聊到sublime,想想sublime也用了1~2個月但其實還沒有很深入研究它究竟有多少好用的功能, 所以就特地上網查了一下sublime plugin,有發現一篇文章原文 中文翻譯。 今天安裝了底下幾個plugin

  • JS Format - 可以幫你按照javascript format來重新排版。
  • Bracket Highlighter - 可以把一些大括號中括號等的用比較顯眼的顏色標記出來。
  • Alignment - 雖然可以把code對齊但我覺得用JS Format出來的就OK了。

過幾天再來試其它的plugin。

Emberjs With Requirejs

這幾天survey了requirejs順便讓它與emberjs跑在一起,有些心得所以在這裡紀錄一下。

Continue reading →

使用漂亮的code Blocks

前幾天在寫emberjs dynamic URL的範例時覺得為什麼預設的code block這麼不好看。 上網google了一下找到這篇文章 介紹如何使用預設在octopress裡面更好看的code blocks。

Continue reading →