This file contains hidden or 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 'parslet' | |
require 'pp' | |
class HTTPParser < Parslet::Parser | |
# | |
# Character Classes | |
# | |
rule(:digit) { match('[0-9]') } | |
rule(:digits) { digit.repeat(1) } | |
rule(:xdigit) { digit | match('[a-fA-F]') } |
This file contains hidden or 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
# | |
# A C Parser using the Parslet library. | |
# | |
# ANSI C Grammar: | |
# | |
# * http://www.lysator.liu.se/c/ANSI-C-grammar-l.html | |
# * http://www.lysator.liu.se/c/ANSI-C-grammar-y.html | |
# | |
require 'parslet' |
This file contains hidden or 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 -v | |
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux] | |
$ ab -n 1000 http://localhost:8080/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 100 requests | |
Completed 200 requests |
This file contains hidden or 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 'net/http' | |
require 'json' | |
require 'date' | |
class PriorArt < Struct.new(:name,:description,:created_at,:updated_at) | |
end | |
prior_art = {} |
This file contains hidden or 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 'rbtree' | |
class Req | |
attr_accessor :path, :time, :requires, :exception | |
def initialize(path) | |
@path = path | |
@requires = [] | |
@time = 0 | |
end |
This file contains hidden or 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.2-p180 :001 > require './require_benchmark.rb' | |
=> true | |
ruby-1.9.2-p180 :002 > require 'ronin' | |
=> true | |
ruby-1.9.2-p180 :003 > | |
0.00090616 tsort | |
0.001040251 enumerator | |
0.001549864 pathname | |
0.001783703 set | |
0.001899229 data_paths/data_paths |
This file contains hidden or 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 Command | |
def initialize(path,arguments,env={}) | |
@path = path | |
@arguments = arguments | |
@env = env | |
end | |
def to_ary | |
[@env, @path, @arguments] |
This file contains hidden or 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
ccopy_reg | |
_reconstructor | |
p0 | |
(clib.core.datatype | |
injectionDict | |
p1 | |
c__builtin__ | |
dict | |
p2 | |
(dp3 |
This file contains hidden or 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 'pp' | |
invalids = ObjectSpace.each_object(DataMapper::Resource).select { |obj| !obj.saved? && !obj.valid? } | |
pp invalids.map { |obj| [obj.class, obj.errors.to_hash] } |
This file contains hidden or 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 Mixin | |
def self.included(base) | |
base.module_eval do | |
def self.mixin(*modules,&block) | |
@mixin_modules = modules | |
@mixin_block = block | |
def self.included(base) | |
unless @mixin_modules.empty? | |
base.send(:include,*@mixin_modules) |