Skip to content

Instantly share code, notes, and snippets.

Avatar
©️
 ​[object Object] :trollface:

Aaron Patterson tenderlove

©️
 ​[object Object] :trollface:
View GitHub Profile
View rake_in_30_lines.rb
require "set"
module RakeTask
CALLED = Set.new
NAMESPACES = []
TASKS = Hash.new { |h, k| h[k] = Struct.new(:blocks, :deps).new([], []) }
class << self
def call(name)
return if CALLED.include?(name)
View meta.rb
require "rubygems"
require "johnson"
require "./visitor.rb"
js =<<-END
function top() {
"top docstring", { command: true }
doSomething();
};
View pivotal tracker api client.rb
=begin
Pivotal Tracker API client (note: super-not-ready)
USAGE
Finding a project:
project = PivotalTracker::Projet.find(1)
We couldn’t find that file to show.
We couldn’t find that file to show.
View gist:29491
require 'rubygems'
require 'nokogiri'
class Nokogiri::XML::Node
def method_missing name, *args, &block
if args.empty?
list = xpath("./#{name}")
elsif args.first.is_a? Hash
hash = args.first
if hash[:css]
View gist:50663
module Nokogiri
module XML
class Builder
def insert_html(html)
Nokogiri::HTML.fragment(html).each do |child|
insert child
end
end
View test_nokogiri_sax_parser.rb
require "rubygems"
require "nokogiri"
require "eventmachine"
##
# This is the XML SAX Parser that accepts "pushed" content used by Babylon Gem.
class XmppParser < Nokogiri::XML::SAX::Document
##
# Initialize the parser and adds the callback that will be called upen stanza completion
View builder_leak.rb
require "rubygems"
require "nokogiri"
require 'dike'
Dike.logfactory '/tmp/dikelogfactory/'
class ZipZap
attr_reader :zip, :zap
def initialize
@zip = "zip"
@zap = "zap"
View File.here.rb
# Require slash
# by Aaron Patterson
# inspired by Josh Susser
# use to require files relative to the current file:
#
# require __FILE__/"lib"/"foo"
# require __FILE__/%{lib foo}
class String