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.rb | |
user system total real | |
hpricot:doc 0.230000 0.010000 0.240000 ( 0.265904) | |
nokogiri:doc 0.030000 0.010000 0.040000 ( 0.041641) | |
user system total real | |
hpricot:xpath 1.050000 0.020000 1.070000 ( 1.114454) | |
nokogiri:xpath 0.210000 0.010000 0.220000 ( 0.226418) | |
user system total real | |
hpricot:css 1.140000 0.030000 1.170000 ( 1.339635) | |
nokogiri:css 0.700000 0.010000 0.710000 ( 0.835559) |
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
user system total real | |
json:parse 0.100000 0.010000 0.110000 ( 0.106557) | |
json:parse! 0.110000 0.000000 0.110000 ( 0.129599) |
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
# Micro-benchmark for new OrderedHash impl in http://github.com/rails/rails/commit/355f41d8aafd75d76db25cdda4736e0052b0605c | |
class OrderedHash < Hash | |
def initialize(*args, &block) | |
super | |
@keys = [] | |
end | |
def []=(key, value) | |
if !has_key?(key) | |
@keys << key |
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
// Show popup when user hovers over a child element of a container div. | |
$('div.child', '#container').mouseover(function() { | |
$('#popup').show(); | |
}); | |
// But hide it only when the mouse pointer leaves the container. Mouseout doesn't | |
// work here because of event bubbling - it'll trigger on child elements of | |
// #container as well. | |
$('#container').bind('mouseleave', function() { | |
$('#popup').hide(); |
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
function foo() { | |
if (!arguments.callee.done) { | |
arguments.callee.done = true; | |
} else { | |
return; | |
} | |
// Actual code here. | |
} |
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
builder = Nokogiri::XML::Builder.new do |xml| | |
xml.listings { | |
xml.language 'en' | |
properties.each do |property| | |
xml.listing { | |
# Instantiate a Nokogiri::XML::Node and insert it manually. | |
node = Nokogiri::XML::Node.new('id', doc) # doc is actually Nokogiri::XML::Builder#doc. | |
node.content = property.id |
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
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("friendfeed.com") { | |
body,input.l_toinput { | |
background-color: #202420!important; | |
color: #fff!important; | |
} | |
div.comments { | |
color: #eaeaea!important; |
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
./scan-build -k -V -o foo/ xcodebuild -configuration Debug -sdk iphonesimulator3.0 |
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
static NSString *CellIdentifier = @"Cell"; | |
cell = (MyCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) { | |
NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"TableCell" owner:self options:nil]; | |
cell = [nibContents objectAtIndex:0]; | |
} | |
// do your customization | |
return cell; |
OlderNewer