Skip to content

Instantly share code, notes, and snippets.

View joshbuddy's full-sized avatar
🤡
meow

Joshua Hull joshbuddy

🤡
meow
View GitHub Profile
require('./lib/sherpa')
var sys = require("sys"), http = require("http");
http.createServer(new Sherpa.interfaces.NodeJs([
['/hello', function (request, response) {
response.sendHeader(200, {"Content-Type": "text/plain"});
response.sendBody("Hello World\n");
response.finish();
}],
irb(main):001:0> def my_awesome_sauce; end
=> nil
irb(main):002:0> methods
=> ["chws", "inspect", "irb_kill", "irb_push_binding", "tap", "install_alias_method", "pwws", "context", "clone", "irb_source", "public", "irb_workspaces", "public_methods", "object_id", "__send__", "irb_popws", "instance_variable_defined?", "irb_quit", "irb_change_workspace", "equal?", "freeze", "jobs", "irb_push_workspace", "extend", "irb_load", "send", "irb_print_working_workspace", "methods", "cws", "irb_pushb", "kill", "conf", "hash", "irb_current_working_binding", "dup", "to_enum", "instance_variables", "quit", "popws", "irb_fg", "eql?", "instance_eval", "irb_cwws", "irb", "id", "irb_change_binding", "singleton_methods", "irb_help", "pushb", "exit", "taint", "private", "irb_print_working_binding", "instance_variable_get", "frozen?", "enum_for", "workspaces", "display", "instance_of?", "irb_pop_binding", "method", "to_a", "irb_chws", "irb_pushws", "instance_exec", "type", "irb_require", "irb_pwws", "protected_methods", "irb_cb", "
@joshbuddy
joshbuddy / output
Created October 24, 2009 18:58 — forked from jpignata/output
#!/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
#!/usr/bin/env python
"""Universal feed parser
Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
Visit http://feedparser.org/ for the latest version
Visit http://feedparser.org/docs/ for the latest documentation
Required: Python 2.1 or later
Recommended: Python 2.3 or later
require 'lib/usher'
u = Usher::Interface.for(:text) do
on('my name is :name') { |name|
puts "hey #{name}, nice to meet you"
}
on('hey :first_name( :last_name)') {|first_name, last_name|
puts last_name ?
"how are you doing #{first_name} #{last_name}?" :
require "rubygems"
require "rbench"
def omg_slow
Array['one', 'two', 'three']
end
def omg_fast
['one', 'two', 'three']
end
# 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)
| rack-router bootup time | usher bootup time |
-----------------------------------------------------------------------
Awesome x10 | 42.350 | 2.692 |
irb(main):007:0> puts app.call(Rack::MockRequest.env_for("/hello"))
200
Hello
=> nil
irb(main):008:0>
irb(main):009:0*
irb(main):010:0*
irb(main):011:0* quit
replacement:usher joshua$ irb
router:
#initialize(parent_router || nil)
#map('path', options = nil)
returned object supports attr_accessor :to
returned object supports attr_accessor :name
#context
returns object with attr_reader :host, :port, :scheme, :base_uri
#recognize(request_object, path)