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 fractals

Oh, and check out this post at Implements Developer for another great way to create the Mandelbrot Set in Ruby.

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 '/'
end

On 02/17/2010 at 10:13 PM 127.0.0.1 said, “Hello World!”

Subversion: Merging a Branch into Trunk

Posted by Ryan Baxter Wed, 26 Aug 2009 01:21:00 GMT

I can never remember how to merge a Subversion branch into trunk. So for future reference, here is how it’s done.

First, get a working copy of the head revision of trunk.

svn checkout svn://svnserver/project/trunk project

Next, merge the branch with your working copy.

svn merge svn://svnserver/project/trunk svn://svnserver/project/branches/branch project

Finally, commit the results of the merge.

cd project
svn commit -m "Merging branch X.X.X into trunk."

You can also specify a revision number in your merge.

svn merge svn://svnserver/project/trunk@223 svn://svnserver/project/branches/branch@223 project

That’s it.

Older posts: 1 2 3 ... 9