Skip to content

Instantly share code, notes, and snippets.

View kschiess's full-sized avatar
💭
see .plan

Kaspar Schiess kschiess

💭
see .plan
View GitHub Profile
$:.unshift 'PATHTOINTERNALSCODE'
require 'string_internals.bundle'
def scan_for title, s, indent=0
GC.start
times = 0
content = ''
ObjectSpace.each_object(String) do |str|
if str == s
times += 1
require 'parslet'
require 'parslet/convenience'
require 'pp'
def parse(input)
parser = SongParser.new
begin
tree = parser.parse(input)
rescue Parslet::ParseFailed => error
puts error, parser.root.error_tree
require 'rubygems'
require 'parslet'
require 'pp'
class JSON < Parslet::Parser
rule(:space) { match('\s').repeat(1) }
rule(:space?) { space.maybe }
rule(:quote) { str('"') }
rule(:nonquote) { str('"').absnt? >> any }
rule(:comma) { str(',') >> space? }
@kschiess
kschiess / symbol_hash_to_a.rb
Created May 3, 2010 06:50 — forked from floere/symbol_hash_to_a.rb
Exploration on to_proc and each
# Its easy really, you want the proc to 'plus' to arguments really, so
# just put a plus in there!
# (Or: Most flagrant abuse of unary plus)
class AsArgument < Struct.new(:symbol)
def to_proc
proc { |el| send(symbol, el) }
end
end
class Symbol