2011年12月8日 星期四

2011年10月20日 星期四

[Erlang] Simple sample to parse XML by xmerl

XML:
<Bookstore>
  <Book>
    <ISBN>9781401309657</ISBN>
    <Name>The Last Letcture</Name>
    <Author>Randy Pausch</Author>
  </Book>
</Bookstore>
Code: Result:
[{'ISBN',"9781401309657"},
 {'Name',"The Last Letcture"},
 {'Author',"Randy Pausch"}]

2011年9月28日 星期三

[JavaScript] Repeat Words

 有時候看似簡單的問題, 也有很多不同的解法

如果要你用 JavaScript 寫一個 function 叫 repeat_words

repeat_words('a', 4); // output: 'aaaa'

你會怎麼寫呢?

通常第一個反應一定是用一個迴圈, 像這樣:
但有一種解法更快更簡單, 利用 Array 的 join, 有時候稍微轉個念, 就會衍生出更多方法了

2011年7月11日 星期一

[生活札記] 我身邊有這樣一位朋友

我身邊有這樣一位朋友, 他熱愛設計, 熱愛工作, 熱愛電影, 喜歡愛因斯坦跟若干日本設計師。

開心時會大聲的大笑, 東西做不出來時對著電腦罵髒話。

超愛鍋貼跟水餃、茶。

他,是一位美國人。


2011年6月30日 星期四

[jQuery] use .filter(':visible') to replace $('#id:visible')

Sometimes we will use

$('div:visible') // Does not use querySelectorAll()

to select something is visible, but it dose not utilize querySelectorAll()

so we can use

$('div').filter(':visible') // Uses it

to get high performance

See Also

http://tutorialzine.com/2011/06/15-powerful-jquery-tips-and-tricks-for-developers/
Related Posts Plugin for WordPress, Blogger...