Skip to content

Instantly share code, notes, and snippets.

View mizoR's full-sized avatar
🗼

Ryutaro Mizokami mizoR

🗼
  • Fukuoka, Japan
View GitHub Profile
var targetUsername = 'ccc';
var jsons = $("#downloaded").val().split("\n");
jsons = $.map(jsons, function (json, i) {
json = JSON.parse(json);
if (json.username === targetUsername) {
return {"key": json.username, "count": 1, "like": json.like}
} else {
return null;
}
});
@mizoR
mizoR / gist:3785734
Created September 26, 2012 02:54
インスタンスメソッドの中で、メソッド定義を書いたときの挙動
➜ ~ irb
irb(main):001:0> class MyClass
irb(main):002:1> def one
irb(main):003:2> def two
irb(main):004:3> 'hello'
irb(main):005:3> end
irb(main):006:2> end
irb(main):007:1> end
=> nil
irb(main):008:0> MyClass.instance_methods(false).grep /one/