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 take3subtake1part1() { | |
| const concurrencyLimit = 5; | |
| // Enhance arguments array to have an index of the argument at hand | |
| const argsCopy = [].concat(listOfArguments.map((val, ind) => ({ val, ind }))); | |
| const result = new Array(listOfArguments.length); | |
| const promises = new Array(concurrencyLimit).fill(Promise.resolve()); | |
| // Recursively chain the next Promise to the currently executed Promise | |
| function chainNext(p) { | |
| if (argsCopy.length) { | |
| const arg = argsCopy.shift(); |
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
| // Blob may contain something else, check https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send#Syntax | |
| // Keep in mind this requires preflight | |
| const blob = new Blob(['this is a test'], { type: 'application/x-www-form-urlencoded'}) | |
| const xhr = new XMLHttpRequest(); | |
| xhr.open("POST", 'http://localhost:8080/files', true); | |
| xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); | |
| xhr.onreadystatechange = function() { |
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
| // npm i eosjs node-fetch | |
| // node eosjs-tx-singing-example.js | |
| 'use strict' | |
| const { Api, JsonRpc } = require('eosjs') | |
| const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig') | |
| const fetch = require('node-fetch') | |
| const { TextDecoder, TextEncoder } = require('util') | |
| const privateKeys = ['_INSERT_PRIVATE_KEY_'] |
OlderNewer