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
module Foo | |
def foo | |
p :before | |
super | |
p :after | |
end | |
end | |
class Bar | |
def foo | |
p :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
Wakupdude.controllers :dudes do | |
set :haml, {:format => :html5 } | |
# get :index do | |
# render "dudes/index" | |
# end | |
get :all, "/" do | |
@dudes = Dude.all() | |
render "dudes/list" |
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
p gems.map{|g|g[/_on_(.*)/,1]}.compact.inject({}){|h,g|(h[g]||=0);h[g]+=1;h} | |
p gems.map{|g|g[/_for_(.*)/,1]}.compact.inject({}){|h,g|(h[g]||=0);h[g]+=1;h} | |
p gems.map{|g|g[/_with_(.*)/,1]}.compact.inject({}){|h,g|(h[g]||=0);h[g]+=1;h} | |
p gems.map{|g|g[/_in_(.*)/,1]}.compact.inject({}){|h,g|(h[g]||=0);h[g]+=1;h} | |
p gems.map{|g|g[/_as_(.*)/,1]}.compact.inject({}){|h,g|(h[g]||=0);h[g]+=1;h} |
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 HTTPParser = process.binding('http_parser').HTTPParser; | |
var net = require('net'); | |
var path = require('path'); | |
var sys = require('sys'); | |
var Worker = require('webworker/webworker').Worker; | |
var VHOSTS = ['foo.bar.com', 'baz.bizzle.com']; | |
var WORKERS = {}; | |
VHOSTS.forEach(function(vh) { |
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
crapbook-pro:http_router joshua$ ruby benchmarks/rec2.rb | |
Results | | |
------------------------------------- | |
2 levels, static 1.845 | | |
4 levels, static 2.066 | | |
8 levels, static 2.223 | | |
4 levels, 1 dynamic 2.206 | | |
8 levels, 3 dynamic 2.714 | | |
4 levels, 1 greedy 2.915 | | |
17044 |
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
@route_set = Usher::Interface.for(:rack) | |
@route_set.get("/static").serves_static_from('/public/file/root') | |
# serves files from /public/file/root on any request starting with /static |
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
>> Anybase::Base73ForURL.to_native((1 << 128)-1) | |
=> "Se'IgbSCfu$0)cMM(odbD" | |
>> Anybase::Base73ForURL.to_native((1 << 128)-1).size | |
=> 21 | |
>> Anybase::Hex.to_native((1 << 128)-1) | |
=> "ffffffffffffffffffffffffffffffff" | |
>> Anybase::Hex.to_native((1 << 128)-1).size | |
=> 32 |
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
(function () { | |
// exports will be set in any commonjs platform. | |
// because the anonymous function is being called without | |
// a scope being set, "this" will refer to the global scope. | |
// In a browser, that's the window. In other JS platforms, | |
// it may be some other thing. | |
var out = typeof exports !== "undefined" ? exports : this; | |
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
crapbook-pro:emjay joshua$ node examples/nodejs/test.js | |
--------------------------------- RENDERED | |
Doing simple output | |
simple output | |
Outputting a variable passed into the template. | |
test title | |
Doing output with mixed in method, tag. | |
<test attr="value"> |
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
> String.prototype.markAsAwesome = function() { | |
> this.awesome = true; | |
> return this; | |
> } | |
> var s = "this is my string"; | |
> puts(inspect(s)); | |
< "this is my string" |