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
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
(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
#!/usr/bin/env ruby | |
require 'pcaplet' | |
Pcaplet.new('-i en1 -s 1500').each do |packet| | |
if packet.class == Pcap::TCPPacket and !packet.tcp_data.nil? | |
words = packet.tcp_data.split | |
words.reject! { |word| word.match(/[^A-Za-z]/) || word.length < 5 } | |
random_word = words[rand(words.size)] | |
system("clear && figlet -c #{random_word}") if random_word | |
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
require "rubygems" | |
require "rbench" | |
def omg_slow | |
Array['one', 'two', 'three'] | |
end | |
def omg_fast | |
['one', 'two', 'three'] | |
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
# ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9.6.0] | |
user system total real | |
by_define_method 0.680000 0.000000 0.680000 ( 0.700586) | |
by_explicit_definition 0.560000 0.010000 0.570000 ( 0.581977) | |
by_eval 0.550000 0.000000 0.550000 ( 0.553484) | |
by_class_eval 0.540000 0.010000 0.550000 ( 0.561800) | |
by_class_eval_block 0.540000 0.000000 0.540000 ( 0.548041) | |
by_module_eval 0.550000 0.010000 0.560000 ( 0.560635) | |
by_module_eval_block 0.520000 0.000000 0.520000 ( 0.539168) |
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 "active_support/core_ext" | |
require "action_controller/new_base/http" | |
require "rack/router" | |
module Rails | |
class Sinatra < ActionController::Http | |
include AbstractController::Renderer | |
include AbstractController::Callbacks | |
include AbstractController::Helpers | |