Welcome To Snipplr


Everyone's Recent Ruby Snippets



1 ... 5 6 7 8 9 ... 12
This is as simple as it gets, basiclly this templates shows you how to mock an object methods to any other piece of code that you like (open objects at its simplest glory).
1 305 posted 13 years ago by narkisr
https://www.chrisjmendez.com/2008/06/21/ruby-mixing-in-a-module-immediately-after-an-objects-singleton-class/
2 367 posted 13 years ago by chrisaiv
Requires all Ruby source files in a given directory.
1 323 posted 13 years ago by jccovey
1 415 posted 13 years ago by tonic
REXML does not seem to have a 'lang' method, which is strange since lang is in the XML 1.0 Specification §2.12 'Language Identification', and in many other libraries. Because of Ruby's 'monkey patching', it's pretty easy to add - you just recursivel...
1 242 posted 13 years ago by tommorris
https://www.chrisjmendez.com/2008/06/04/ruby-open-a-text-file-and-re-write-its-contents-into-a-new-text-file/
1 463 posted 13 years ago by chrisaiv
alternative to using DateTime.now.to_s
1 405 posted 13 years ago by jhenry
Simple command line option parser snippet
1 398 posted 13 years ago by mikegreen
Hat tip: Allan Odgaard
1 390 posted 13 years ago by breakerjump
Generates a ChangeLog from git repository.
1 308 posted 13 years ago by felipec
1 401 posted 13 years ago by lakedenman
1 279 posted 13 years ago by crazylion
This is an example of how to search within a Ferret index (based upon http://kasparov.skife.org/blog/src/ruby/ferret.html).
1 391 posted 13 years ago by narkisr
This is a simple example for building a search index with the Ferret library (based upon http://kasparov.skife.org/blog/src/ruby/ferret.html).
1 479 posted 13 years ago by narkisr
I didn't create this but I use it all the time. Just drop it in lib/tasks/fixtures.rake
1 285 posted 13 years ago by markpercival
This example shows how to release artifacts into Artifactory by using Buildr, the origin of this code is http://groups.google.com/group/buildr-talk/
1 259 posted 13 years ago by narkisr
1 274 posted 13 years ago by dbug13
Command line currency convertor, just copy and paste. I named mine 'coin'. Make sure you have Ruby, Rubygems and Hpricot (gem install hpricot). e.g. ~$ coin 100 eur usd 158.3300 Uses the site xurrency.com.
1 380 posted 13 years ago by plexus
1 312 posted 13 years ago by inkdeep
2 297 posted 13 years ago by inkdeep
1 315 posted 13 years ago by neil
provides a tidy way to add initialization by hash to new classes
1 276 posted 13 years ago by neil
Useful for speeding up searches.
1 381 posted 13 years ago by jarnaldich
Note: most of these will be available to the shell and Rails' console too.
2 375 posted 13 years ago by cczona
1 ... 5 6 7 8 9 ... 12