Welcome To Snipplr
Everyone's Recent Ruby Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Quick conversion from a string of binary into ascii, and back again.\r\nUse B* for MSB and b* for LSB first.
0
820
posted 14 years ago by jimbobmcfred
I’ve recently had to parse some pretty large XML documents, and needed a method to read one element at a time.
Here’s a fairly simple solution in Ruby form.
0
826
posted 14 years ago by dom111
validate :price_must_be_at_least_a_cent
protected def price_must_be_at_least_a_cent
errors.add(:price, 'should be at least 0.01') if price.nil? || price < 0.01
end
0
676
posted 14 years ago by stayce
This Ruby script generates the [Gnome Terminals For Rails script](http://snipplr.com/view/32227/gnome-terminals-for-rails/ "Gnome Terminals For Rails").
0
541
posted 14 years ago by draq