Skip to content

Instantly share code, notes, and snippets.

@Erushenko
Erushenko / basic.sql
Created November 1, 2017 14:35 — forked from nesquena/basic.sql
PostgreSQL Common Utility Queries
/* How to calculate postgreSQL database size in disk ? */
SELECT pg_size_pretty(pg_database_size('thedbname'));
/* Calculate size of a table including or excluding the index */
SELECT pg_size_pretty(pg_total_relation_size('big_table'));
SELECT pg_size_pretty(pg_relation_size('big_table')); /* without index */
/* See indexes on a table with `\d tablename` */
@Erushenko
Erushenko / destructuring.js
Created August 8, 2017 09:10 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@Erushenko
Erushenko / curl.md
Last active June 9, 2017 09:33 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Erushenko
Erushenko / remove.js
Created May 15, 2017 16:30 — forked from max-frai/remove.js
Remove outgoing facebook friend requests
var interval = window.setInterval(function() {
var moreButton = document.querySelector('a[ajaxify*="outgoing/more"]');
if (moreButton)
{
moreButton.click();
console.log('loading more...');
}
else
{
//window.clearInterval(interval);
@Erushenko
Erushenko / json_postgres.js
Created April 14, 2017 12:59 — forked from lucdew/json_postgres.js
Example of json document storage in postgresql and querying (with knex.js)
var connectionString = 'postgres://localhost:5432/postgres';
var Promise=require('bluebird');
var knex = require('knex')({
client: 'pg',
connection: {
user: 'postgres',
database: 'postgres',
port: 5432,