Skip to content

Instantly share code, notes, and snippets.

login: &login
username: root
development:
adapter: mysql
database: searchlogic_development
<<: *login
test:
adapter: mysql
A common idiom is to use || to assign a value to a variable only if that variable isn't already set. This can be written as:
1. @variable = @variable || "default value"
@variable = @variable || "default value"
or, more idiomatically, as:
1. @variable ||= "default value"
# application.helper
def default_text(text)
onClickFunction = "field = event.target; if (field.value=='#{text}') {field.value = '';}else {return false}"
onBlurFunction = "field = event.target; if (field.value=='') {field.value = '#{text}';}else {return false}"
{:value => text, :onclick => onClickFunction, :onblur => onBlurFunction}
end
# view
@minikermit
minikermit / gitoriginchange
Created August 27, 2011 14:58
Change a git remote origin
The easiest way to tweak this imho is to edit the .git/config file in your repository. Look for the entry you messed up and just tweak the URL.
On my machine in a repo I reguarlly use it looks like this:
KidA% cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true