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 'rubygems' | |
require 'sinatra/base' | |
class Hello < Sinatra::Base | |
get '/' do | |
"hello world" | |
end | |
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
puts "hello world?" | |
#raise "CRAZY EXCEPTION!" |
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
begin | |
base = ARGV.length > 0 ? ARGV[0].to_i : 12 | |
rescue | |
puts "usuage: | |
ruby #{__FILE__} {number} | |
(number = 12 by default)" | |
end | |
puts "times table in base #{base}:" | |
(base + 1).times {|x| | |
(base + 1).times {|y| |
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 DSL | |
def go (&block) | |
instance_eval &block if block | |
self | |
end | |
def self.go (&block) | |
DSL.new.go(&block) |
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
foo ||= true | |
puts foo | |
foo = nil | |
foo ||= true | |
puts foo | |
foo = false | |
foo ||= true | |
puts foo |
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
var sys = require('sys'), | |
exec = require('child_process').exec; | |
// fs = require('fs'); | |
// ecsv = require('ecsv') | |
function Queue () { | |
var waiting = []; | |
this.max = -1; | |
this.current = 0; | |
//run checks if we're under the max processors, and runs if there is room. |
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
exports.hello = function(){return 'HI'); |
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
//test-uncaught-errors | |
var sys = require('sys') | |
, EventEmitter = require('events').EventEmitter; | |
function error1 (err){ | |
sys.puts("Handle: " + err); | |
} | |
function error2 (err){ | |
sys.puts("JANDAL: " + err); | |
} | |
function exit (){ |
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
if (module == require.main) { | |
return require('async_testing').run(process.ARGV); | |
} | |
require('async_testing/lib/child') | |
exports ['test should fail'] = function (test){ | |
test.ok(false) | |
} |
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
//async_testing.runfile.asynct | |
exports ['does not call onSuiteDone twice'] = function (test){ | |
var file = 'async_testing/test/test-stderr' | |
require('async_testing').runFile(file,{onSuiteDone:suiteDone}) | |
function suiteDone (status,report){ | |
console.log("suiteDone - " + status + "'" + file + "'") |
OlderNewer