Welcome To Snipplr


Everyone's Recent Ruby Snippets



1 ... 8 9 10 11 12
Requires the twitter bundle. This is an early attempt at updating this. Pretty crude at the moment, but it works.
2 2109 posted 19 years ago by gtcaz
2 2121 posted 19 years ago by gtcaz
Adapted from http://journal.mychores.co.uk/articles/2007/01/21/updating-twitter-from-ruby-rails
2 2055 posted 19 years ago by gtcaz
Requires wget and curl.
2 2237 posted 19 years ago by gtcaz
Renders the partial template called 'cart', sends along local variable @cart, this will be known locally using the same name as the partial, 'cart'.
1 1832 posted 19 years ago by wackimonki
The code tests if session[:counter] exists. If you leave out the all important '?', it will fail with an error.
1 2110 posted 19 years ago by wackimonki
This will add up all the prices and return it? What does |item| mean exactly?
2 2149 posted 19 years ago by wackimonki
1 1703 posted 19 years ago by jordanbrock
Redirects from one method to another in a controller. This is handy when there's an error, and you need to go back to index page, or for other purposes.
1 1911 posted 19 years ago by wackimonki
Adds a button in view, which triggers a method. "Empty cart" is the button name empty_cart is the method name
1 2010 posted 19 years ago by wackimonki
Catches an exception error, uses a technique called flash to display error on another page. The Ruby on Rails code needs to be in a controller. The rhtml code needs to be in the index layout.
1 1892 posted 19 years ago by wackimonki
3 3472 posted 19 years ago by gtcaz
2 2043 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 1886 posted 19 years ago by vanne
Displays a image inside link_to instead of text.
2 2350 posted 19 years ago by ryanprel
1 1987 posted 19 years ago by andyh
Extend any float object to allow for decimal conversion
1 1872 posted 19 years ago by vanne
Add this to your ~/.irbrc file and you will have inline logging in the console
1 1844 posted 19 years ago by vanne
Use this to sanitize a string and convert all wierd characters to your choice of delimiter
1 1974 posted 19 years ago by vanne
2 1687 posted 19 years ago by gnatware
2 1870 posted 19 years ago by gnatware
Define multiple associations on the same associated class. From the Rails Way blog.
1 1675 posted 19 years ago by gnatware
1 1974 posted 19 years ago by spider
3 3433 posted 19 years ago by spider
3 2289 posted 19 years ago by zuwiki
This replaces the PHP-based function in the HTML bundle. You need to add two files to your bundle's Support/lib folder (create the directories if they're not present): http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/vend...
6 3811 posted 19 years ago by gtcaz
An example ajax form tag
5 3059 posted 19 years ago by jordanbrock
Alternative bundle command for e (http://www.e-texteditor.com) or TextMate. Replace YOUR_API_KEY_HERE with a valid API key -- you can find it on your Settings page (http://snipplr.com/settings/). Changed the command to allow selection of langua...
10 3262 posted 19 years ago by gtcaz
This command allows you to browse your snippet collection on Snipplr and retrieve them into e. Requires the installation of the wxCocoaDialog exe in the /Support/bin subdirectory. Replace YOUR_API_KEY_HERE with the API key -- you can find it on y...
6 3688 posted 19 years ago by gtcaz
1 ... 8 9 10 11 12