Skip to content

Instantly share code, notes, and snippets.

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
{
"compilerOptions": {
/* Basic Options */
"target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es6"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
@16kilobyte
16kilobyte / groupBy.js
Created March 7, 2019 08:54
Method takes a key and groups objects of an array (if running `groupCondition` on the object yields true) by the key passed.
/**
* Method takes a key and groups objects of an array
* (if running `groupCondition` on the object yields true)
* by the key passed.
*
* @param {string} key The key to group the object of the array by
* @param {function} groupCondition Function that is run on every
* object in the array and if it returns true, the object is then grouped
*
* @returns {array} Array of objects grouped by key
@16kilobyte
16kilobyte / deepClone.js
Created June 23, 2018 09:06
Deep clone an object
/**
* @type {Function}
*/
var toString = Object.prototype.toString;
/**
* @description Clones an object using deep copy
*
* @param {Object} sourceObject Object to clone
* @returns {Object} Cloned object.
@16kilobyte
16kilobyte / repeat_every.rb
Created April 15, 2018 00:20
Ruby repeat a block every n seconds for timeout_in seconds
def repeat_every(n = 10.seconds, timeout_in = 60.seconds)
begin
Timeout.timeout(timeout_in_seconds) do
loop do
yield false if block_given?
sleep n
end
end
rescue Timeout::Error