match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
- Best Practice:
- Either specify HTTP verbs or use
via: :all
when adding routes with#match
// @author: Vishal Telangre <the@vishaltelangre.com> | |
// Published under MIT license. | |
// | |
// Requires: jQuery | |
// | |
// Usage: | |
// | |
// ieInspector.isIe | |
// -- returns | |
// - true for IE browsers |
# This hosts file is brought to you by Dan Pollock and can be found at | |
# http://someonewhocares.org/hosts/zero/ | |
# You are free to copy and distribute this file, as long the original | |
# URL is included. See below for acknowledgements. | |
# Please forward any additions, corrections or comments by email to | |
# hosts@someonewhocares.org | |
# Last updated: Apr 7th, 2013 at 13:35 |
# places_controller.rb | |
class PlacesController < ApplicationController | |
def index | |
@place[:map_data] = Places.find(params[:id]).to_gmaps4rails | |
respond_to do |format| | |
format.html | |
end | |
end | |
end |
// USAGE | |
function Person(el) { | |
this.name = ''; | |
$(el).change(jQuery.proxy(function(event) { | |
this.name = event.target.value; | |
}, this)); | |
} |
# take dump of specific db | |
mysqldump -u vishal -p foo_db_dev > foo_db_dev_dump.sql | |
# take dump of all available databases | |
mysqldump -u vishal -p -r -A > foo_db_dev_dump.sql | |
# import dump of specific db | |
mysql --verbose -u vishal -p --default-character-set=utf8 foo_db_dev < foo_db_dev_dump.sql |
def try_chain | |
yield | |
rescue NoMethodError | |
nil | |
end | |
def title | |
try_chain { output.data.title } | |
end |
// check flash support for visitor browser | |
function isFlashSupported() { | |
var hasFlash = false; | |
try { | |
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); | |
if(fo) hasFlash = true; | |
}catch(e){ | |
if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) { | |
hasFlash = true; | |
} |