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
| export async function parallelBy( | |
| fns: Array<() => Promise<any>>, | |
| limit: number | |
| ) { | |
| let resolved = 0; | |
| let flying: Array<Promise<any>> = []; | |
| const results = Array(fns.length); | |
| let done = false; | |
| if (limit >= fns.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
| console.log("Welcome to Deno 🦕"); |
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
| /** | |
| * @param {number[][]} dungeon | |
| * @return {number} | |
| */ | |
| var calculateMinimumHP = function(dungeon) { | |
| const xMax = dungeon[0].length - 1; | |
| const yMax = dungeon.length - 1; | |
| const hp = new Map([ | |
| [key(xMax + 1, yMax), 1], |
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 O = 'O'; | |
| const X = 'X'; | |
| const T = 'T'; | |
| /** | |
| * @param {character[][]} board | |
| * @return {void} Do not return anything, modify board in-place instead. | |
| */ | |
| var solve = function(board) { | |
| if (board.length < 2 || board[0].length < 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
| /** | |
| * @param {number} n | |
| * @param {number[][]} flights | |
| * @param {number} src | |
| * @param {number} dst | |
| * @param {number} K | |
| * @return {number} | |
| */ | |
| var findCheapestPrice = function(n, flights, src, dst, K) { | |
| const flightsGraph = createGraph(flights); |
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 nums = [7, 6, 5, 1]; | |
| const operations = new Set(['+', '-', '*', '/']); | |
| function permutations(nums, result = [], results = []) { | |
| if (nums.length === 0) { | |
| results.push([...result]); | |
| return; | |
| } | |
| for (let [index, num] of nums.entries()) { |
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 | |
| const { spawnSync } = require('child_process'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const packageJsonPath = path.resolve('package.json'); | |
| const getPackageJson = () => | |
| JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); |
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
| diff --git a/hosts/merchant-center-minsky1.dub1.yml b/hosts/merchant-center-minsky1.dub1.yml | |
| index 4d762e42b..17455f215 100644 | |
| --- a/hosts/merchant-center-minsky1.dub1.yml | |
| +++ b/hosts/merchant-center-minsky1.dub1.yml | |
| @@ -8,7 +8,7 @@ hardware: | |
| unit: 8 | |
| vc: access1-1-3-3.dub1 | |
| vmhost: itier-vmhost47-prod.dub1 | |
| -hostclass: skeletor_node_v8-2018.03.05_22.02 | |
| +hostclass: skeletor_node_v10-2018.12.11_19.04 |
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
| (async function() { | |
| async function f1() { | |
| return new Promise(res => { | |
| setTimeout(() => { | |
| res('1.1'); | |
| }, 1000); | |
| }); | |
| } | |
| async function f2() { |
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
| console.log('test gist 123'); |
NewerOlder