Skip to content

Instantly share code, notes, and snippets.

View eliblocks's full-sized avatar

Eli Block eliblocks

  • San Francisco, CA
View GitHub Profile
@moresheth
moresheth / caveman_time.rb
Created April 27, 2012 16:58
Convert seconds to extended time
# Caveman
def seconds_to_extended(seconds)
hours = 0
minutes = 0
while seconds >= 3600
hours += 1
seconds -= 3600
end
while seconds >= 60
minutes += 1
@velosipedist
velosipedist / postgresql-list-foreign-keys.sql
Created October 31, 2013 13:52
List all foreign keys in PostgreSQL database, analog of MySQL SHOW CREATE TABLE mytable;
--- Source: http://solaimurugan.blogspot.ru/2010/10/list-out-all-forien-key-constraints.html
SELECT
tc.constraint_name,
tc.constraint_type,
tc.table_name,
kcu.column_name,
tc.is_deferrable,
tc.initially_deferred,
rc.match_option AS match_type,