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
require 'onion' | |
Onion.new Stats, Memoizer, TimesOut do | |
config :stats => true, :timeout => 1_000, :pool_size => 20 | |
puts "Forward:" | |
transaction do | |
query "SELECT ... FROM ... FOR UPDATE ..." | |
execute "INSERT ..." |
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
Forward: | |
Instantiating Query Object | |
Selecting SELECT ... FROM ... FOR UPDATE ... (501) | |
Did not timeout! Yay fast database | |
Measured select at 0 seconds | |
Instantiating Query Object | |
Executing INSERT ... (501) | |
Did not timeout! Yay fast database | |
Measured select at 0 seconds | |
Executing INSERT ... (501) |
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
; A monad comprehension is a syntactic construct that translates | |
; synchronous-looking code into a callback-based implementation. Monads | |
; are a very general abstraction - which means that monad comprehensions | |
; have more expressive power than other sync-to-async code | |
; transformations. | |
; Here is an example that uses jQuery's $.get method to fetch resources: | |
(def post-with-author (id) | |
(for |
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
function isType (type) { | |
return function (arg) { | |
return typeof(arg) === type; | |
}; | |
} | |
function instanceOf (clazz) { | |
return function (arg) { | |
return arg instanceof clazz; | |
}; |