Archive for February 2012
-
Rambling Trie 0.3.3 has been released!
February 13, 2012
This post was originally published in the Rambling Labs Blog on February 13, 2012.
The new version of the
rambling-trie
gem is out! As I said on my previous post, therambling-trie
is an implementation of the Trie data structure in Ruby.Version 0.3.3 has several performance improvements, and I also added the code’s documentation via Yard. Also, since the previous version (0.3.2), the methods
has_branch_for?
andis_word?
have been fixed for the compressed trie.For the uncompressed trie, the
has_branch_for?
andis_word?
methods work very fast. The compressed trie’sis_word?
method is as fast as it’s uncompressed counterpart, but thehas_branch_for?
is a bit slower.I’ve also added some benchmarking reports for each version of the
rambling…
-
Rambling Trie: A custom Trie data structure implementation in Ruby
February 10, 2012
This post was originally published in the Rambling Labs Blog on February 10, 2012.
We’re proud to announce that our first gem is here!
It’s called
rambling-trie
, and it’s an implementation of the Trie data structure. A Trie is an ordered tree data structure, and it is great for managing dictionaries and for word searching and matching.Now, to install the
rambling-trie
, you can either install it manually by running:gem install rambling-trie
Or, you can add this line to the Gemfile of your application:
gem 'rambling-trie'
To create a new Trie you can do this:
require 'rambling-trie' trie = Rambling::Trie.new
And to add a new word to the Trie, you can call this:
trie.add_branch_from 'word'
Or to automatically load words from a file…
-
Writing your blog posts in Markdown with Postmarkdown
February 3, 2012
This post was originally published in the Rambling Labs Blog on February 3, 2012.
Another thing we added to our new site, uploaded back at the end of December, was the ability to write our blog posts in Markdown, which is a text-to-html tool that allows you to write formatted text without actually having to write all the corresponding HTML. Markdown is used for the project wiki pages on GitHub, and can also be used for the project’s readme file.
Most of the time, I don’t like that HTML gets autogenerated for me, since I usually don’t get the results I want. We used to have the site (which was really the blog only) in WordPress, and I never used the autogenerated HTML. In fact, it was quite the opposite: I wrote every blog post in plain…
-
Migrating your blog posts to Markdown with Upmark and Nokogiri
February 3, 2012
This post was originally published in the Rambling Labs Blog on February 3, 2012.
As I said in my last post, for our new site, we changed our blog engine from WordPress to the Postmarkdown gem. At the end of that post, I mentioned that we had to migrate the old posts from WordPress to Markdown.
To do this, we built a ruby script using the Upmark gem and the Nokogiri gem. Nokogiri is used for HTML and XML parsing, among other things, while Upmark is used to generate Markdown from a given HTML.
First, we exported our old blog posts from WordPress to an XML file that looks like this:
<?xml version="1.0" encoding="UTF-8" ?> <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. --> <!-- ... --> <rss