rewrite setTimeout and setInterval to allow use of ruby blocks