- 1. Item 1
- 2. Item 2
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.HTML DATA | |
doc.xpath('//div//text()').map { |x| x.content = x.to_s } | |
p doc.serialize(:save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION) | |
__END__ | |
<div> <span>x</span></div> |
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
# Put this file in your config/initializers directory and behold a tastier auto_link! | |
module ActionView | |
module Helpers | |
module TextHelper | |
# Use auto_link and friends from Rails 3. They do the right thing (tm). | |
remove_const(:AUTO_LINK_RE) if defined?(AUTO_LINK_RE) | |
AUTO_LINK_RE = %r{ | |
( https?:// | www\. ) |
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
# Convert an array of nested key parts into a nested Hash and convert the | |
# value to a proper Ruby object. | |
# | |
# keyparts - An Array of String parts of the nested Hash. For instance, the | |
# list ['a', 'b', 'c'] would lead to a nested hash that looks like | |
# {'a' => {'b' => {'c' => X}}}. | |
# val - The String value that will be converted into the proper Boolean, | |
# Integer, or String. | |
# | |
# Returns the nested Hash. |
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
[21:24][tom@lepton:~(master)]$ perl --version | |
This is perl, v5.10.0 built for darwin-thread-multi-2level | |
(with 2 registered patches, see perl -V for more detail) | |
[21:23][tom@lepton:~(master)]$ cat test.pod | |
=head1 Title | |
=over 4 |
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
$ git config --global user.name "Tom Preston-Werner" | |
$ git config --global user.email "tom@mojombo.com" | |
$ git config --global color.ui true |
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
Another mustache.erl example, this time showing off lists and asking for context in one of the view functions. |
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
Just a simple demonstration of how to use my soon-to-be-released mustache.erl library. Mustaches forever! |
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
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | |
require 'rubygems' | |
require 'bert' | |
require 'json' | |
require 'yajl' | |
require 'benchmark' | |
ITER = 1_000 |
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
Failed on server connect attempt 1. Trying again... | |
Uncaught exception | |
recieved ConnectionUnbound for an unknown signature: f6f17803599e03b44307e9cbe741a2284 | |
/Users/tom/.rip/active/lib/eventmachine.rb:1485:in `event_callback' | |
/Users/tom/.rip/active/lib/eventmachine.rb:245:in `release_machine' | |
/Users/tom/.rip/active/lib/eventmachine.rb:245:in `run' | |
./bin/../lib/proxymachine.rb:70:in `run' | |
bin/proxymachine:36 |