Skip to content

Instantly share code, notes, and snippets.

View gomesalexandre's full-sized avatar

gomes gomesalexandre

View GitHub Profile
@tokland
tokland / promise_map.js
Last active September 8, 2024 15:10 — forked from anvk/promises_reduce.js
Execute promises sequentially (one at at a time) and return array with the results
function promiseMap(inputValues, mapper) {
const reducer = (acc$, inputValue) =>
acc$.then(acc => mapper(inputValue).then(result => acc.push(result) && acc));
return inputValues.reduce(reducer, Promise.resolve([]));
}
/* Example */
const axios = require('axios');
@zpetr
zpetr / .gitignore
Last active May 9, 2023 00:31 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@mkremins
mkremins / pbcopy.js
Created April 17, 2014 21:41
node.js: put text into OS X clipboard
function pbcopy(data) {
var proc = require('child_process').spawn('pbcopy');
proc.stdin.write(data);
proc.stdin.end();
}