Welcome To Snipplr


Everyone's Recent Ruby Snippets Tagged ruby



1 2 3 4 5 6 ... 9
Groovy has the as keyword which enables the implementation of a Java interface by using the as keyword, its quite easy to mimic this in JRuby.
0 1702 posted 16 years ago by narkisr
0 1443 posted 16 years ago by AzizLight
1 1626 posted 16 years ago by AzizLight
To run, save as twitterbackup.rb: ruby twitterbackup.rb yourtwittername
1 1688 posted 16 years ago by beandr
Code for a Rake task that allows compiles all LESS stylesheets (.less) contained within a single directory.
0 1457 posted 16 years ago by brettbergeron
0 1166 posted 16 years ago by kungfoo
1 1100 posted 16 years ago by webstic
0 1067 posted 16 years ago by kungfoo
Probably not the most elegant solution, but it works. Needed this for a capistrano deploy task which shows the most recent tagged releases in my repository. Very bare bones, and needs tweaking if your versions are not in X.X.X.X format.
1 1573 posted 16 years ago by bananastalktome
For moving from older gem to newest if ' sudo gem update --system ' doesn't work
1 1172 posted 16 years ago by inkdeep
What a gotcha!
2 1610 posted 16 years ago by wdso
1 1299 posted 16 years ago by flyingmachine
3 2576 posted 16 years ago by sionnnn
1 1327 posted 16 years ago by dbug13
Creating a object that doesn't have any methods in Ruby (regular objects inherit methods from Object class), useful for Proxies that use method missing (http://onestepback.org/index.cgi/Tech/Ruby/BlankSlate.rdoc).
1 1774 posted 16 years ago by narkisr
An example of redo statement in Ruby, redo makes an iteration step repeat itself again (http://www.rubyrailways.com/rubys-most-underused-keyword/).
1 1367 posted 16 years ago by narkisr
I had a directory tree with around 4000 pdf files and I needed a page count - so I semi-rolled this. I swiped the counter code from the gem README: http://github.com/yob/pdf-reader/tree/master It could be more contained - as is I run it from irb:...
1 1944 posted 17 years ago by inkdeep
3 2487 posted 17 years ago by dbug13
1 1184 posted 17 years ago by paramah
2 1658 posted 17 years ago by paramah
2 1281 posted 17 years ago by Krypt
Select text Right-click, select "Filter through command..."
1 1229 posted 17 years ago by reedelrub
Rake task - Copies files from one directory to another in a batch of 50 files, giving 15 seconds break between each batch.
1 1728 posted 17 years ago by cnicolaou
1 2 3 4 5 6 ... 9