Ruby Fractal Library 1.2.2
Posted by Ryan Baxter Tue, 09 Mar 2010 04:34:00 GMT
The Ruby Fractal Library now uses ChunkyPNG. Thanks to Willem van Bergen for creating a 100% pure Ruby PNG solution! ChunkyPNG provides full read/write capabilities of PNG files without the dependency hassle of bigger image libraries. Install fractals and enjoy the chunky goodness.
sudo gem install fractalsOh, and check out this post at Implements Developer for another great way to create the Mandelbrot Set in Ruby.
- Posted in Code Snippets
- Meta no comments, permalink, rss, atom
Hello MongoDB
Posted by Ryan Baxter Thu, 18 Feb 2010 04:11:00 GMT
In an effort to jump-start my creativity, I thought I’d hop on the NoSQL train and work up a little “Hello World” app using MongoDB with Sinatra and MongoMapper. In a later project I’ll be throwing Haml into the mix and working completely outside of my comfort zone. Dependencies be damned!
require 'rubygems'
require 'mongo_mapper'
require 'sinatra'
MongoMapper.connection = Mongo::Connection.new('localhost')
MongoMapper.database = 'messages'
class Message
include MongoMapper::Document
key :message, String
key :ip_address, String
timestamps!
end
get '/' do
Message.all.map { |m|
time = m.created_at.localtime
"On #{ time.strftime('%m/%d/%Y') } at " \
"#{ time.strftime('%I:%M %p')} <strong>#{ m.ip_address }</strong> said, " \
"<strong>\"#{ m.message }\"</strong>"
}.join "<br />"
end
get '/:message' do
Message.create(:message => params[:message], :ip_address => @env['REMOTE_ADDR']).save
redirect '/'
endOn 02/17/2010 at 10:13 PM 127.0.0.1 said, “Hello World!”
- Posted in Code Snippets
- Meta no comments, permalink, rss, atom
Ruby Fractal Library 1.2.0
Posted by Ryan Baxter Thu, 27 Aug 2009 02:36:00 GMT
I’ve finally released version 1.2.0 of the Ruby Fractal Library. It’s still just as small and easy to use, but with a few new twists. I’ve removed most of the duplicate code, added Procs where appropriate, and made the syntax more consistent. The result is much more readable and should be easier to maintain.
- The source code has been split into multiple files. One for each module.
- Each of the fractals has been distilled to a single block passed to the Fractal base class’ constructor. This makes it easy to construct new orbits fractals by either inheriting from Fractal or instantiating it directly.
- Classes have been added for the Burning Ship and Newton fractals.
- A ‘Winter’ theme has been added.
- Users can now choose which dependancy nightmare they’d prefer. PNG, RMagick and JRuby each have their own renderer. PNGRenderer is the default, but is easy to override with the renderer= method.
- bailout and max_iterations are no longer constructor parameters. This is the biggest breaking change.
- Unit tests have been added for each fractal.
- Several rake tasks have been added to make installation and gem creation easier.
- RDoc documentation is now available.
A project for this library has been created at RubyForge, but the source code can still be found at the same old place. I’m considering a move to github, but I’ll make an announcement if that happens. If you decide to download the Ruby Fractal Library, be sure to check out examples.rb in the project’s source. You should also take a look at the README file and documentation before getting started. Make some fractals and enjoy! Bugs can be filed at the RubyForge tracker.
- Meta 2 comments, permalink, rss, atom

