The blog has moved to http://jessehouse.com/ ... Many google searches point here so I am leaving it operational, but there will be no new posts.

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

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

make_fk_unless_exists :projects, :milestone_id, :milestones
make_fk_unless_exists :tasks, :project_id, :projects
...