This file contains hidden or 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
/** | |
* | |
* The Example of using custom replacer function for JSON.stringify: | |
* | |
* 1. Imagine, You have to store some amount of UNIQUE Objects in a Map or an Array. [or just compare two objects]. | |
* Stringified object (or some hash function applied to) could be used as a key to store Object. | |
* 2. The order of Elements Inside Object or Array (FOR THIS PARTICULAR CASE) does not matter. E.g: [1,3,2] equals [1,2,3]. | |
* | |
*/ |
This file contains hidden or 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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or 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 idx.relname as table, | |
idx.indexrelname as index, | |
pg_relation_size( idx.indexrelname::text )/1024/1024 as bytes, | |
cls.relpages as pages, | |
cls.reltuples as tuples, | |
idx.idx_scan as scanned, | |
idx.idx_tup_read as read, | |
idx.idx_tup_fetch as fetched | |
FROM pg_stat_user_indexes idx, | |
pg_class cls , |
This file contains hidden or 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
/** | |
* Convert a string to Capitalized Case. | |
* | |
* @example | |
* 'hello_world'.toCapitalizedCase() // Will return `Hello World`. | |
* 'fOO BAR'.toCapitalizedCase() // Will return `Foo Bar`. | |
* 'asdsaads sadasd "2123asd-asd-as"'.toPascalLikeCase() // Will return `Asdsaads Sadasd "2123asd-Asd-As"` | |
* | |
* @returns {string} | |
* The Pascal-like Cased string. |
This file contains hidden or 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
/** | |
* | |
* Universal recursive Promise.all for Arrays and Objects | |
* | |
* | |
* Example Inputs: | |
* { | |
* test1: 1, | |
* test2: someAsyncFunctionReturnsArray(), |
This file contains hidden or 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
<template> | |
<div> | |
<input v-validate data-rules="required" :class="{'has-error': errors.has("textInput")}" id="textInput" name="textInput" type="text"> | |
<span class="error" v-show="errors.has("textInput")">{{ errors.first("textInput") }}</span> | |
</div> | |
</template> | |
<script> | |
import { find, propEq } from 'ramda' | |
import bus from './bus' |