View hello_sinatra.rb
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 |
View hello.rb
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!" |
View base12.rb
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| |
View dsl.rb
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) |
View set default.rb
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 |
View queue.js
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. |
View hello_from_nodule.js
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'); |
View handle_the_jandal.js
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 (){ |
View child.asynct.js
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) | |
} |
View async_testing.runfile.asynct.js
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