View hello_sinatra.rb
require 'rubygems' | |
require 'sinatra/base' | |
class Hello < Sinatra::Base | |
get '/' do | |
"hello world" | |
end | |
end |
View hello.rb
puts "hello world?" | |
#raise "CRAZY EXCEPTION!" |
View base12.rb
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| |
View dsl.rb
class DSL | |
def go (&block) | |
instance_eval &block if block | |
self | |
end | |
def self.go (&block) | |
DSL.new.go(&block) |
View set default.rb
foo ||= true | |
puts foo | |
foo = nil | |
foo ||= true | |
puts foo | |
foo = false | |
foo ||= true | |
puts foo |
View queue.js
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. |
View hello_from_nodule.js
exports.hello = function(){return 'HI'); |
View handle_the_jandal.js
//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 (){ |
View child.asynct.js
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) | |
} |
View async_testing.runfile.asynct.js
//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