This file contains 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
{ | |
"command": "1.0.1" | |
} |
This file contains 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 fetch = require("node-fetch"); | |
const fs = require("fs"); | |
const url = "your url"; | |
(async () => { | |
const response = await fetch(url); | |
const buffer = await response.buffer(); |
This file contains 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
#include "stdio.h" | |
#include <stack> | |
#include <vector> | |
#include <iostream> | |
#include "string" | |
using namespace std; | |
struct Comparator | |
{ |
This file contains 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
// -- simple | |
function isIterator(obj) { | |
return !!obj && !!obj[Symbol.iterator]; | |
} | |
function allSettled(iterable) { | |
if (!isIterator(iterable)) { | |
throw new Error('[allSettled] first param must be iterable'); | |
} |
This file contains 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
Promise | |
.all([promise1,promise2,promise3]) | |
.then(fn) | |
.catch(fn) |
This file contains 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 promise1 = Promise.resolve(3); | |
const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, 'foo')); | |
const promises = [promise1, promise2]; | |
Promise.allSettled(promises) | |
.then((results) => results.forEach((result) => console.log(result.status))); | |
// expected output: | |
// "fulfilled" | |
// "rejected" |
This file contains 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 curry = f => (a, ..._) => _.length > 0 | |
? f(a, ..._) | |
: (..._) => f(a, ..._); | |
const isIter = iter => iter && iter[Symbol.iterator]; | |
const toIter = iter => isIter(iter) ? iter[Symbol.iterator]() : function* () { } | |
const go1 = (a, f) => a instanceof Promise ? a.then(f) : f(a); | |
// const go2 = (acc, value, f) => value instanceof Promise |
This file contains 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
## ssl issue | |
apt-get install libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.5 libgdm-dev libdb4o-cil-dev libpcap-dev -y | |
## python version 3.6.8 | |
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz | |
tar -xf Python-3.6.8.tar.xz | |
/tmp/python-temp/Python-3.6.8/configure --enable-loadable-sqlite-extensions && \ | |
make && make install |
This file contains 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
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "build_c", | |
"type": "shell", | |
"command": "gcc", | |
"args": [ |
This file contains 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 deepFindValue(obj, value) { | |
let results = []; | |
return function recur(obj, value) { | |
for (let key of Object.keys(obj)) { | |
if (typeof obj[key] === 'object') { | |
recur(obj[key], value) | |
} else if (obj[key] === value) { |
NewerOlder