Skip to content

Instantly share code, notes, and snippets.

View FractalizeR's full-sized avatar
💭
Working for Yandex.Eats as a TeamLead

Vladislav Rastrusny FractalizeR

💭
Working for Yandex.Eats as a TeamLead
View GitHub Profile
@FractalizeR
FractalizeR / gist:5e7f71a01d9078217249
Created December 29, 2014 16:44
Load jQuery from CDN, if fails - locallly
<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>
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,
@FractalizeR
FractalizeR / postgres_get_indexes.sql
Created December 9, 2014 16:06
Postgres: get a list of all indexes with extended information
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(
<?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];
}
?>