Run sql statements from the command line, use the -c flag
create a random value
crazy updates using regexp_matches
House 9
Sunday, April 29, 2012
postgres: terminate all database connections
Using psql from the command line you can terminate all connections to a database
Comes in handy when you want to do things like restore your staging or development database
Labels:
postgresql
Friday, February 3, 2012
Git Workflow
This is the current git workflow we are using at work, your mileage may vary:
Resources
Resources
- http://cheat.errtheblog.com/s/git
- http://yanpritzker.com/gitbook.html#Keeping+a+topic+branch+in+sync+with+its+parent
- http://yanpritzker.com/gitbook.html#One+branch+per+bug
- http://gitready.com/beginner/2009/02/02/push-and-delete-branches.html
- http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
- http://sleeplessgeek.blogspot.com/2011/03/using-git-cherry-pick.html
Friday, December 30, 2011
Inspect all jQuery events on an element
Very useful
$("SELECTOR").data("events");
All bound event handlers are stored in the elements data context under the events key
This can be very useful when debugging with tools like FireBug
$("form").submit(function () { alert('submit form'); });
$("form").data("events");
> Object { submit=[1] }
Resources
$("SELECTOR").data("events");
All bound event handlers are stored in the elements data context under the events key
This can be very useful when debugging with tools like FireBug
$("form").submit(function () { alert('submit form'); });
$("form").data("events");
> Object { submit=[1] }
Resources
Labels:
javascript,
jquery
Friday, December 2, 2011
Get table and column information in postgres
Use the information_schema catalog - http://www.postgresql.org/docs/9.1/static/information-schema.html
Get table and columns from the public schema
This can be useful, maybe you want to auto generate some text that creates foreign keys based on a naming convention - for instance let's say we have a ruby/rails method called make_fk_unless_exists
The 'code' column would render something like
Get table and columns from the public schema
This can be useful, maybe you want to auto generate some text that creates foreign keys based on a naming convention - for instance let's say we have a ruby/rails method called make_fk_unless_exists
The 'code' column would render something like
make_fk_unless_exists :projects, :milestone_id, :milestones
make_fk_unless_exists :tasks, :project_id, :projects
...
Labels:
postgresql
Saturday, November 12, 2011
Sample Routes and Links with Rails 3 in the console
The content for this post is all from a gist, hopefully someone finds it useful
Resources
Resources
Labels:
rails
Subscribe to:
Posts (Atom)