View gist:5e7f71a01d9078217249
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
if (typeof jQuery == 'undefined') | |
{ | |
document.write(unescape("%3Cscript src='Scripts/jquery.1.9.1.min.js' type='text/javascript'%3E%3C/script%3E")); | |
} | |
</script> |
View PostgreSQL DESCRIBE TABLE.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
f.attnum AS number, | |
f.attname AS name, | |
f.attnum, | |
f.attnotnull AS notnull, | |
pg_catalog.format_type(f.atttypid,f.atttypmod) AS type, | |
CASE | |
WHEN p.contype = 'p' THEN 't' | |
ELSE 'f' | |
END AS primarykey, |
View postgres_get_indexes.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
U.usename AS user_name, | |
ns.nspname AS schema_name, | |
idx.indrelid :: REGCLASS AS table_name, | |
i.relname AS index_name, | |
idx.indisunique AS is_unique, | |
idx.indisprimary AS is_primary, | |
am.amname AS index_type, | |
idx.indkey, | |
ARRAY( |
View human_byte_size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function human_filesize($bytes, $decimals = 2) { | |
$sz = 'BKMGTP'; | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor]; | |
} | |
?> |