Thomas Swift

Running a West Coast Offense since ‘81

Entries Tagged as 'ruby'

Say no to stupid ruby gem install errors

November 8th, 2007 · No Comments

I know that people work hard on ruby docs, but I always get errors and it takes for ever when I’m trying to hack on ruby stuff.
Latest gem to do this to me is json gem.
error
Installing ri documentation for json-1.1.1…
/usr/local/lib/ruby/1.8/rdoc/rdoc.rb:101:in `error’: (RDoc::RDocError)
Directory /usr/local/lib/ruby/gems/1.8/doc/json-1.1.1/ri already exists, but it looks like it
isn’t an RDoc directory. Because […]

[Read more →]

Tags: ruby

URL Decoding in Ruby

October 14th, 2007 · No Comments

This is very simple.

require “cgi”

def url_decode(address)
clean_address = CGI::unescape(address)
end

final_address = url_decode(”http%3A%2F%2Fwww%2Ethomasswift%2Ecom%2Fblog%2Furl%2Ddecoding%2Din%2Druby%2F”)
puts final_address

Save it and run it.
If for some reason this doesn’t suit your need, here are some other resources I was checking out.
Eric Meyer’s URL Encoder/Decoder - Code is included, but didn’t work on backslashes.
Kurt Dommermuth’s Flash URL Encoded/Decoder
URLEncode Chart

[Read more →]

Tags: ruby

Testing out Anvil: The Ruby Application Framework

September 12th, 2007 · 1 Comment

Just saw this on Ruby Inside about the Anvil DSL/Framework for creating ruby gui apps.
Pretty cool, I have been looking at Shoes, but I don’t have an Intel Mac, and I don’t touch a PC unless I have to.
But enough talking, let’s try it out with the proof of concept app called Hamr, a text […]

[Read more →]

Tags: ruby

Ruby String Replace

March 22nd, 2007 · 3 Comments

update: I noticed I am dominating google searches for “ruby string replace”, if you have a particular example you are looking for or snippet you might need some help with, feel free to leave a comment or drop me an email and i’ll try to help you.
I just want to replace [width=”ANYNUMBER] with [width=”300] and […]

[Read more →]

Tags: ruby