Welcome To Snipplr


Everyone's Recent Snippets



1 ... 528 529 530 531 532 ... 553
Returns an array of values specified for an enumerated MySQL field
2 1945 posted 18 years ago by johnself
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 1351 posted 18 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 1554 posted 18 years ago by wackimonki
This will add up all the prices and return it? What does |item| mean exactly?
2 1575 posted 18 years ago by wackimonki
1 1224 posted 18 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 1443 posted 18 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 1480 posted 18 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 1364 posted 18 years ago by wackimonki
0 1098 posted 18 years ago by jonathanbp
2 things here. currency (euro) with in a 2.00 format and select entries older than 4 weeks = 28 days
2 1726 posted 18 years ago by assbach
This example demonstrates usage of Scriptella ETL Tool to load CSV data into a database table.
3 2312 posted 18 years ago by ejboy
This Scriptella ETL script copies all rows from Src_Table to Dest_Table. Src_Table contains the following columns: id, first_name, last_name Dest_Table contains the following columns: id, name The name column of the Dest_Table is produced by a con...
1 2051 posted 18 years ago by ejboy
Scriptella ETL allows inserting files into a database. This is achieved by a simple bind variables extension syntax ?{file ...}. The following sample initializes table of music tracks. Each track has a DATA field containing a file loaded from an ext...
1 2026 posted 18 years ago by ejboy
A CountEvent class’s instance counts up from 0 to 50, then dispatches "countComplete" event. Here’s a result below. 1 2 3 . . . 48 49 50 Count Complete
0 7673 posted 18 years ago by garamond
Needed a way to mix up the order of questions and answers for a Flash quiz. https://www.chrisjmendez.com/2007/02/21/as1-swap-numbers/
0 1223 posted 18 years ago by chrisaiv
useful if a "valid until" should have an exact ( in this case far future ) value.
0 1265 posted 18 years ago by assbach
Based on the linked SitePoint article but with options to limit the container (eg body copy) and set the target. Use '_blank' for a new window for each link. Also adds a class (based on the rel value) for styling. Call the 'relWindow' on window load.
2 1725 posted 18 years ago by mountainash
0 1272 posted 18 years ago by ryanprel
Function to look if an element has a class, if it doesn't simply add it to the element. If it does have a class add it to the class that is already there. Function expects 2 values, the element to add the class to, and the new class name (value).
3 2186 posted 18 years ago by 1man
3 2823 posted 18 years ago by gtcaz
3 1703 posted 18 years ago by soxiam
2 1491 posted 18 years ago by gtcaz
This function looks for tables in a web page, then loops through the rows and sets the backgroundColor for ever other row.This creates a striped table which is easier to read.
2 2011 posted 18 years ago by 1man
Use this function to queue functions you wish to load on window onload. Very useful when code becomes complex.
3 2249 posted 18 years ago by 1man
Usage of the getNextElement function. Very basic usage to pick out the h1 tags, then change the properties of the next element(not node).
1 1570 posted 18 years ago by 1man
Useful function for CSS DOM, returns the next element after the selected node. So you could style the element directly after a h1 element for example.
2 1525 posted 18 years ago by 1man
1 ... 528 529 530 531 532 ... 553