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
| const size = 250_000; | |
| const input = new Array(size).fill(undefined).map((_, index) => index); | |
| [ | |
| { | |
| name: '.map()', | |
| fn: () => { | |
| input.map((e) => e * 2); | |
| } | |
| }, |
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
| #!/bin/bash | |
| set -e | |
| declare -x USERNAME="$1" | |
| declare -x USERPIC="$2" | |
| declare -r DSIMPORT_CMD="/usr/bin/dsimport" | |
| declare -r ID_CMD="/usr/bin/id" |
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
| const someObj = { | |
| map: new Map([['uno', 1], ['dos', 2]]), | |
| set: new Set([1,2,3,4,5,5,6,7]), | |
| obj: { uno: 1, dos: 2 }, | |
| arr: [1,2,3,4,5,5,6,7], | |
| date: new Date('1991-12-15T00:00:00-0300'), | |
| dateISO: '1991-12-15T00:00:00-0300', |
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
| function promisesAll(promisesCollection) { | |
| return new Promise((resolve, reject) => { | |
| const resolved = []; | |
| promisesCollection.forEach((promise, index) => { | |
| promise | |
| .then((value) => { | |
| resolved.push({ index, value }); | |
| if (resolved.length === promisesCollection.length) { |
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
| #!/usr/bin/env node | |
| /** | |
| * Obtaining Amazon SES SMTP credentials by converting existing AWS credentials | |
| * | |
| * @author Jesus Urrutia <[email protected]> | |
| * | |
| * Script based on: | |
| * https://docs.aws.amazon.com/ses/latest/dg/smtp-credentials.html | |
| */ |
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
| /* eslint-disable consistent-return */ | |
| function joiExtensionJson(joi) { | |
| return { | |
| type: 'json', | |
| base: joi.any(), | |
| messages: { | |
| 'json.base': '{{#label}} is not a valid json', | |
| 'json.schema': '{{#label}} does not meet schema. ({{#error}})', |
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
| git --git-dir=../<some_other_repo>/.git \ | |
| format-patch -k -1 --stdout <commit SHA> | \ | |
| git am -3 -k |
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
| /** | |
| * | |
| * @typedef {Object} UsePromiseOptions | |
| * @property {boolean} [lazy=false] - when true, Promise not call into first render | |
| * | |
| * @typedef {Object} UsePromiseState | |
| * @property {*} data - data resolved by Promise | |
| * @property {Error|null} error - data rejected by Promise, if exists | |
| * @property {boolean} loading - when true, Promise is pending | |
| * @property {Function} callPromise - manually call Promise |
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
| grid = [ [4, 0, 0, 0, 0, 5, 0, 0, 0], | |
| [0, 0, 0, 0, 0, 0, 1, 9, 8], | |
| [3, 0, 0, 0, 8, 2, 4, 0, 0], | |
| [0, 0, 0, 1, 0, 0, 0, 8, 0], | |
| [9, 0, 3, 0, 0, 0, 0, 0, 0], | |
| [0, 0, 0, 0, 3, 0, 6, 7, 0], | |
| [0, 5, 0, 0, 0, 9, 0, 0, 0], | |
| [0, 0, 0, 2, 0, 0, 9, 0, 7], | |
| [6, 4, 0, 3, 0, 0, 0, 0, 0], ] |
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
| class Request { | |
| constructor(baseURL, { timeout, ...options } = {}) { | |
| this.timeout = timeout; | |
| this.client = axios.create({ | |
| baseURL, | |
| ...options, | |
| }); | |
| return new Proxy(this, { | |
| get(target, property) { |
NewerOlder