Skip to content

Instantly share code, notes, and snippets.

@tmcgann
tmcgann / async-serial-reduction.js
Created July 6, 2020 21:54
Two different ways to process asynchronous requests serially without the use of convenient library like async (https://caolan.github.io/async/v3/docs.html#eachSeries).
(async function () {
// Setup
const values = [1, 2, 3]
const makeTimestamp = () => Math.round(Date.now() / 1000)
const request = (value, time = 1000) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(value)
}, time)
@tmcgann
tmcgann / .prettierrc
Created September 16, 2020 16:19
Preferred Prettier config
{
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"printWidth": 100,
"proseWrap": "preserve",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",