Welcome To Snipplr


Everyone's Recent Snippets Tagged ruby



3 2889 posted 19 years ago by gtcaz
2 1548 posted 19 years ago by gtcaz
Add this inside your .irbrc file to call "show Model" in your console instead of "y Model.column_names"
1 1409 posted 19 years ago by vanne
0 1181 posted 19 years ago by drwitt
1 1501 posted 19 years ago by andyh
Extend any float object to allow for decimal conversion
1 1396 posted 19 years ago by vanne
0 2835 posted 19 years ago by sudarkoff
Add this to your ~/.irbrc file and you will have inline logging in the console
1 1388 posted 19 years ago by vanne
Use this to sanitize a string and convert all wierd characters to your choice of delimiter
1 1444 posted 19 years ago by vanne
1 1475 posted 19 years ago by spider
3 2841 posted 19 years ago by spider
3 1740 posted 19 years ago by zuwiki
An example ajax form tag
5 2490 posted 19 years ago by jordanbrock
There's another snippet here that's pure Ruby. This one can be used from the command line directly. The previous version still used Ruby, this one is pure shell.
0 1629 posted 19 years ago by plexus
Requires aspell and wxCocoaDialog. Now checks all of your selection for misspellings. Known issues: * e doesn't see contractions as a "word", so you must select things like can't, won't, etc. or the command won't see the whole word. * Dupl...
2 1676 posted 19 years ago by gtcaz
This is an example of how to use the wxCocoaDialog dropdown widget from Ruby.
2 1678 posted 19 years ago by gtcaz
used to remove unnecessary duplication of code. Code is from Jamis Buck (http://weblog.jamisbuck.org/2007/1/24/object-with_options)
1 1525 posted 19 years ago by andyh
Using instance_eval to abstract values into meaningful methods
1 1229 posted 19 years ago by vanne
put this into lib/tasks and then run rake db:version
1 1321 posted 19 years ago by vanne
A custom assertion that will allow you to pass a block to find the difference between two values.
1 1233 posted 19 years ago by vanne
Useful for when you need to do a find and map specific results to an array for use later
1 1596 posted 19 years ago by vanne
0 1157 posted 19 years ago by andyh
This is useful for using ActiveRecord validations without the ActiveRecord DB dependencies, this snippet is meant to be used with Textmate... create this in models/name_of_your_model to use.
4 2909 posted 19 years ago by vanne
This allows you to turn off ajax requests application wide, so that you don't have to do render :layout => false in every controller that needs it.
1 1812 posted 19 years ago by vanne
Just name it s3cp (or similar), chmod it, and then you can do stuff like: s3cp ~/somefile.whatever bucket
1 1597 posted 19 years ago by sudarkoff
0 1427 posted 19 years ago by whitetiger