I've never used Underscore.js before. But, we're going to start using some Backbone.js at InVision; and, since Underscore.js is a hard dependency of Backbone.js, we decided to use Underscore's template() method as our client-side HTML partial... 続きを読む
2012年6月18日月曜日 CoffeeScriptで学ぶ Underscore.js 09(Function編) ようやくFunction編です。Underscore.jsの要です。 bind _.bind(function, object, [*arguments]) bindは、関数をオブジェクトにバインドして返します。関数が呼ばれると、第2引数objec... 続きを読む
Underscore.jsのtemplate 以下、Underscore.jsが1.3.3当時の情報です。 template _.template(templateString, [data], [settings]) Underscore.js Utility template Backbone.jsを試すついでに、Underscore.jsについてるtemplateを試してみました。他のテンプレ... 続きを読む
Original Source Code 今回調べてみるソースコードはunderscore.jsのbind関数とbindAll関数。オリジナルのコードは以下の通り。 _.bind = function(func, obj) { if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(argume... 続きを読む
目次 オブジェクト指向と関数型スタイル コレクション each, map, reduce, reduceRight, find, filter, reject, all, any, include,invoke, pluck, max, min, sortBy, groupBy, sortedIndex, shuffle, toArray,size 配列 first, initial, last, rest, compact... 続きを読む
Code Review is a series on DailyJS where I take a look at an open source project to see how it’s built. Along the way we’ll learn patterns and techniques by JavaScript masters. If you’re looking for tips to write better apps, or just want ... 続きを読む
一ヶ月ぶりのブログPOSTです。先月は、色んなことがありました。大きくは3つ。 アメリカのボルチモア(メリーランド州。ワシントンDCから1時間弱ぐらいのところ)にて 5/16 - 19の日程で開催された、RailsConf2011に行ってきました。Ruby on Railsについて、... 続きを読む
OverviewWe've been finding ourselves building more and more JS heavy apps here at &yet. Until recently, we've pretty much invented a custom app architecture for each one.Not surprisingly, we're finding ourselves solving similar problems repea... 続きを読む
JavascriptライブラリUnderscore.jsがすごい便利。すごい便利なのにもかかわらず、あんまり日本語の情報がなかったので、公式のドキュメントをスピリチュアル抄訳してみた。http://documentcloud.github.com/underscore/ Collection Functions each_.each(list,... 続きを読む
プログラム, JavaScript | 00:39 | 便利機能満載のライブラリUnderscore.js - ニノ日記が「力尽きた」と仰っているので勝手に続きを書く Object Functions tap_.tap(object, interceptor)chainを使うときに、途中にobjectを割り込ませ、chainの途中結果を知るこ... 続きを読む