coffeescript

正規表現指定での一括removeClass

正規表現で指定して一括でremoveClassをしたい時があったのでメモ。 $.fn.removeClassMatch = (rexp) -> this.removeClass (i, css) -> (c for c in css.split(' ') when c.match(rexp)).join(' ') githubで公開している方がいたのでリンク

CoffeeScriptでUnderscore.jsの備忘録

_.each [1,2,3], (n)-> console.log n _.each {one:1, two:2, three:3}, (value, key)-> console.log key + '=' + value

CoffeeScriptで三項演算子\(^o^)/

CoffeeScriptだと三項演算子使えないのね。 if a == b then "true" else "false" こう書く位なら、 ` a === b ? "true" : "false" ` javascriptで書いたほうがよい?