This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is LiveScript, really, but GH can't colour it -- yet. | |
time = (n, target) -> | |
t0 = (new Date).getTime! | |
for i from 1 to n then r = target! | |
t = (new Date).getTime! - t0 | |
ta = t / n | |
console.log "[time] #t ms (avg #ta ms)" | |
r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
include Mongoid::Document | |
has_many :bs | |
end | |
class B | |
include Mongoid::Document | |
belongs_to :a | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
include Mongoid::Document | |
embeds_one :b | |
end | |
class B | |
include Mongoid::Document | |
embedded_in :a | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
view.fn 'unwrap', (ob) -> | |
{ key, value } for own key, value of ob) |
NewerOlder