Skip to content

Instantly share code, notes, and snippets.

View gist:6b2aaab50cac65a886b529a470cdb3f5
### Keybase proof
I hereby claim:
* I am ender672 on github.
* I am timothy_elliott ( on keybase.
* I have a public key ASBqzzBkXMw06Qfxt3mwY9GU4kiLzvhHUsfb0CwX37ukQgo
To claim this, I am signing this object:
ender672 /
Created Nov 21, 2014
mitmproxy script for showing omniture events, evars, and props
$ mitmdump -q -s
View fetch.rb
require 'google-search'
require 'uri'
require 'open-uri'
require 'fileutils'
FileUtils.mkdir("images") 'High Quality').each do |image|
name = File.basename(URI.parse(image.uri).path)
path = File.join("images", name)
View gist:2638291
# Puma hangs when it receives a SIGTERM in Linux x86_64. Reproduce as follows:
# Start Puma
# $ puma
# Get the PID for Puma
# $ ps u
# $ kill 4321
ender672 / gist:2582334
Created May 3, 2012
Multithreaded rack handler. Proof-of-concept. Use Puma instead.
View gist:2582334
require 'socket'
require 'uri'
require 'rack/handler' # gem install rack
require 'rack/rewindable_input'
require 'http/parser' # gem install http_parser.rb
require 'stringio'
module Rack::Handler
module Qute
def, options={})
ender672 / gist:2378417
Created Apr 13, 2012
Single-threaded, single-process, non-evented rack handler using the mongrel http parser
View gist:2378417
require 'rack/handler'
require 'socket'
require 'puma/puma_http11'
module Rack::Handler
module Qute
READ_SIZE = 500000
module NullIO
def self.gets; end
ender672 / gist:2175941
Created Mar 23, 2012
A really small image resizing rack application
View gist:2175941
require 'rack'
require 'oil'
app = lambda do |env|
r =
io ='images', File.basename(r.path)), 'rb')
body =, r[:w].to_i, r[:h].to_i)
[200, { 'Content-Type' => 'image/jpeg' }, body]
View gist:1872559
#include <string.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
xmlDocPtr doc;
xmlNodePtr cur;
xmlXPathContextPtr ctx;
View gist:1870254
diff --git a/ext/nokogiri/xml_document.c b/ext/nokogiri/xml_document.c
index 348344c..9f035ad 100644
--- a/ext/nokogiri/xml_document.c
+++ b/ext/nokogiri/xml_document.c
@@ -38,6 +38,13 @@ static void dealloc(xmlDocPtr doc)
+static void
+mark(xmlDocPtr doc)
View gist:1864519
diff --git a/lib/nokogiri/xml/node_set.rb b/lib/nokogiri/xml/node_set.rb
index 37b3848..149e90e 100644
--- a/lib/nokogiri/xml/node_set.rb
+++ b/lib/nokogiri/xml/node_set.rb
@@ -240,6 +240,14 @@ module Nokogiri
+ def map
+ a = []