This file contains 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
diff --git a/lib/nokogiri/xml/node_set.rb b/lib/nokogiri/xml/node_set.rb | |
index 37b3848..cb99cdd 100644 | |
--- a/lib/nokogiri/xml/node_set.rb | |
+++ b/lib/nokogiri/xml/node_set.rb | |
@@ -234,8 +234,8 @@ module Nokogiri | |
### | |
# Iterate over each node, yielding to +block+ | |
- def each(&block) | |
- 0.upto(length - 1) do |x| |
This file contains 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 './signed_request_uri' | |
require 'rack/file' | |
use Rack::SignedRequestUri, 'top secret' | |
run Rack::File.new('images') |
This file contains 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 'benchmark' | |
require 'benchmark/ips' | |
FOO = 'foo' | |
Benchmark.ips do |x| | |
x.report('=') { |times| | |
i = 0 | |
while i < times |
This file contains 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 'rack' | |
require './jimmy' | |
run Rack::Jimmy.new('.') |
This file contains 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 'rack' | |
require 'rack/cache' | |
require './squint' | |
use Rack::Chunked | |
use Rack::Cache, | |
:verbose => true, | |
:allow_reload => false, | |
:metastore => 'file:cache/meta', |
This file contains 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 'nokogiri' | |
xml = <<END | |
<foo xmlns="http://example.com"> | |
<bar xmlns:n1="http://bar.com"> | |
<baz xmlns:n2="http://baz.com"> | |
</baz> | |
</bar> | |
</foo> | |
END |
This file contains 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 'nokogiri' | |
ENTER_PROMPT = 'Running. Press <Enter> to pause.' | |
def ui | |
loop do | |
puts '(c)ontinue' | |
puts '(n)ext' | |
puts '(q)uit' | |
print '> ' |
This file contains 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 'nokogiri' | |
# This test runs an infinite loop which throws from random Nokogiri SAX handler | |
# callbacks. | |
# | |
# It uses the sample XML files in Nokogiri's test suite, and expects to run from | |
# the Nokogiri folder, e.g. via: | |
# $ cd ~/workspace/nokogiri | |
# $ ruby -Ilib smokesax.rb |
This file contains 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 'nokogiri' | |
html = '<html><body><br/></body></html>' | |
# Nokogiri's new HTML encoding detection uses a custom SAX document handler to | |
# "peek" at an IO before parsing it. | |
# | |
# It interrupts the SAX parser by throwing from the context of a SAX document | |
# handler callback: | |
# https://github.com/tenderlove/nokogiri/blob/master/lib/nokogiri/html/document.rb#L144 |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Web Development & Programming Thoughts</title> | |
<meta name="description" content="Timothy Elliott's Technical Blog" /> | |
<meta name="keywords" content="Web Development, Programming" /> | |
<style> | |
body { | |
background-color: #EEE; |