Skip to content

Instantly share code, notes, and snippets.

View vjocw's full-sized avatar

jo vjocw

  • Seattle, WA
View GitHub Profile
@CrabDude
CrabDude / week1_exercise.md
Created August 12, 2016 21:43
[Sample Exercise] Week 1: Parallel Asynchronous recursiveReaddir

Week 1 Challenge - Parallel Asynchronous recursiveReaddir

This exercise is to build an API for recursively listing the files in a directory in parallel, or in other words, a recursive ls. The purpose of this exercise is to practice control-flow for asynchronous IO, specifically running operations in serial and parallel. Additionally, this exercise will explore the fs filesystem module from core.

IMPORTANT: Review the Control-flow Guide to familiarize yourself with async/await. Ignore Promise and callbacks for now.

Getting Started

The checkpoints below should be implemented as pairs. In pair programming, there are two roles: supervisor and driver.

@getify
getify / gist:8459026
Last active August 9, 2020 04:09
example: refactoring some code (in keystonejs) from "callback hell"-style to asynquence-style
var doQuery = function() {
count.exec(function(err, total) {
if (err) return sendError('database error', err);
query.exec(function(err, items) {
if (err) return sendError('database error', err);
sendResponse({