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
hpricot vs. nokogiri: Parsing XML | |
.......... | |
Set 1 mean: 5.368 s | |
Set 1 std dev: 0.052 | |
Set 2 mean: 0.703 s | |
Set 2 std dev: 0.054 | |
p.value: 1.0825088224469e-05 | |
W: 100.0 | |
The difference (-86.9%) IS statistically significant. |
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
I got a segfault when I tried to run this at first, and am now getting lots of | |
"called on terminated object" at random times (!). Wondering what to do at this | |
point... | |
hpricot 0.6.170 | |
nokogiri 1.0.2 | |
ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-linux] | |
-------------------- |
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
#!/usr/bin/env ruby | |
require 'time' | |
#Dir.chdir("/project/prd/Builds/") | |
Dir.chdir( "/project/prd/Builds/nc/logs" ) | |
class Capture < Regexp | |
def NamedMatches( string, names ) | |
theMatches = match( string ) |
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 'hpricot' | |
require 'json' | |
require 'open-uri' | |
class Feed | |
def self.parse( uri ) | |
doc = Hpricot.XML(open(uri)) | |
feed = new(uri) | |
if doc.at(:item) |
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 'better-benchmark' | |
result = Benchmark.compare_realtime( | |
:iterations => 10, | |
:inner_iterations => 10, | |
:verbose => true | |
) { | |
count = 0 | |
while true | |
count += 1 |
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 'ramaze' | |
require 'ramaze/spec/helper' | |
spec_require 'hpricot', 'sequel' | |
$LOAD_PATH.unshift base = __DIR__('..') | |
require 'start' | |
describe 'Wikore' do | |
behaves_like 'http' |
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
With this code, CPU usage shoots to 100% when serving the index page. | |
% gem19 list -l | |
*** LOCAL GEMS *** | |
daemons (1.0.10) | |
diakonos (0.8.7) |
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
#!/usr/bin/env ruby19 | |
require 'rexml/document' | |
class XMLGenealogy | |
INDENTATION = ' ' | |
def initialize( argv ) | |
@namespace_uri = argv[ 0 ] | |
@dir_mask = argv[ 1 ] |
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' | |
doc = Nokogiri::XML( "<xml></xml>" ) | |
doc.xpath( "//*" ).each do |element| | |
p = element.parent | |
if p | |
# p not nil | |
p.namespace # causes segfault | |
end | |
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
#!/usr/bin/env ruby19 | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
# EDIT POST_RECEIVE_URL | |
POST_RECEIVE_URL = 'http://hostname:8910/repository-name/push' | |
old_head, new_head, ref = STDIN.gets.split |
OlderNewer