Skip to content

Instantly share code, notes, and snippets.

@lkfken
lkfken / gist:2974896
Created June 22, 2012 20:10
Simplest Possible Ruby Web Server: Using Rack for a one-liner
#credit to: http://phrogz.net/simplest-possible-ruby-web-server
ruby -rrack -e "include Rack;Handler::Thin.run Builder.new{run Directory.new''}"
@lkfken
lkfken / gist:2967945
Created June 21, 2012 19:25
Verify the unpack string
require 'terminal-table'
def unpack_str_table(unpack_str, data = nil)
len = unpack_str.scan(/\d+/)
sum = 0; idx = 1
fields = len.map { |x| sum += x.to_i }
headings = %w( Index Length Start End )
headings << "Data" unless data.nil?
table = Terminal::Table.new :headings => headings
fields.each do |stop|
require "money"
class Decorator < BasicObject
undef_method :==
def initialize(component)
@component = component
end
def method_missing(name, *args, &block)