Skip to content

Instantly share code, notes, and snippets.

View jbr's full-sized avatar
:octocat:
Focusing on OSS for April

Jacob Rothstein jbr

:octocat:
Focusing on OSS for April
View GitHub Profile
function isType (type) {
return function (arg) {
return typeof(arg) === type;
};
}
function instanceOf (clazz) {
return function (arg) {
return arg instanceof clazz;
};
; 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
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)
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 ..."