Skip to content

Instantly share code, notes, and snippets.

View yaotti's full-sized avatar

Hiroshige Umino yaotti

View GitHub Profile
@yaotti
yaotti / position-paper-yaotti.md
Created January 18, 2012 08:35
Rails勉強会@東京第70回 ポジションペーパー by @yaotti

名前

海野弘成 (うみのひろしげ)

仕事

Qiitaでサーバーサイドの開発をしています. 以前ははてなやGoogle Japanでインターン,アルバイトでwebアプリケーションやiPhoneアプリの開発をしていました.

キーワード

  • Rails 3.1.3
  • Ruby 1.9.2
@yaotti
yaotti / file0.js
Created December 6, 2011 10:29
Backbone.jsでモデルとビューを分離しやすくするためにadd/resetイベントを活用 ref: http://qiita.com/items/1304
model.bind('hoge', function () {
alert('hogeされた');
});
model.trigger('hoge'); // => alert('hogeされた');
@yaotti
yaotti / file0.rb
Created November 8, 2011 14:11
Rubyでクラスメソッドの定義方法色々 ref: http://qiita.com/items/951
class A
def A.class_method_one; end def self.class_method_two; end class << A
def class_method_three; end
end class << self
def class_method_four; end
end
enddef A.class_method_five; endclass << A
def class_method_six; end
end
p 'test'
alert('hello');
puts "hello, world!"
@yaotti
yaotti / backbone-collection-create-deferred.js
Created August 14, 2011 18:45
Model.create({ success: function(){...}})とか書きたくないので関数追加した.もっと綺麗にできればいいんだけど無理そう.
// Return Backbone.sync's retval instead of the saved model
// to use the deferred object ($.ajax: jsdeferred.jquery.js).
Backbone.Collection.prototype.createDeferred = function(model, options) {
var coll = this;
options || (options = {});
model = this._prepareModel(model, options);
if (!model) return false;
return model.save(null, options);
};
p 'hi'
p 'hello'
p 'hello'