Skip to content

Instantly share code, notes, and snippets.

View CrabDude's full-sized avatar

Adam Crabtree CrabDude

View GitHub Profile

Week 1 - Command Line Interfaces (CLIs)

This week, we'll ensure our environments are properly setup and walk through the fundamentals of the node.js runtime with a focus on asynchronous programming, control-flow and IO. We'll keep things simple by sticking primarily to the filesystem, stdin and stdout to write basic CLIs like an asynchronous recursive readdir CLI.

Assignment

Assignment 1: Filesystem CLIs due at 10:00pm

This week, we'll build a collection of common filesystem CLIs. The purpose of this project is to develop a basic understanding of control-flow and the node.js runtime, module system and ascyhronous APIs.

@CrabDude
CrabDude / webGuildYarnLab.md
Created March 27, 2017 19:06
Use yarn to create a new project and manage dependencies.

WebGuild: Yarn Lab

The yarn lab incorporates a few steps:

  1. Install yarn
  2. Create a new project with yarn
  3. Installing/reinstall/syncing project dependencies
  4. Add/remove/update some dependencies

Questions? If you have any questions, ping #webguild.

@CrabDude
CrabDude / README.md
Created September 30, 2016 09:59
An example of a proper README.md for submission.

Proxy Server

This is a Proxy Server for Node.js submitted as the pre-work requirement for the Node.js Bootcamp.

Time spent: 3h

Completed:

  • Required: Requests to port 8000 are echoed back with the same HTTP headers and body
  • Required: Requests/reponses are proxied to/from the destination server

Creating the Proxy Server

The pre-work incorporates a few steps:

  1. Setup your Node.js environment
  2. Complete the introductory NodeSchool.io Workshoppers
  3. Build a proxy server and setup logging
  4. Develop a command-line interface (CLI) to configure the server
  5. Submit the project for review via Github
  6. Extend your proxy server with additional functions
@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.

/*
pins: [{
id, height
}]
*/
// orderedByHeight = [{height: 0, index: 0}]
// Output: datastructure to describe pins
function layoutPins(pins, cols) {
// [{height: 0, index: 0}]
@CrabDude
CrabDude / asyncawait.html
Created November 4, 2015 02:03
BayNode Node Night 11/3/15: async/await by Adam Crabtree
<!DOCTYPE html>
<html>
<head>
<title>Async Await</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
@CrabDude
CrabDude / README.md
Last active August 29, 2015 14:27
A sample Node.js Bootcamp submission README

Proxy Server

This is a Proxy Server for Node.js submitted as the pre-work requirement for CodePath.

Time spent: [Write the number of hours you spend here]

Completed:

  • Required: Requests to port 8000 are echoed back with the same HTTP headers and body
  • Required: Requests/reponses are proxied to/from the destination server
async()=>{
// Pointless calling await because crypto.pbkdf2 returns nothing
await crypto.pbkdf2('asdf', 'salt', 4096, 512, 'sha256', function(err, key) {
if (err) throw err
user.password = key.toString('hex')
console.log(user.password)
// return key.toString('hex') // 'c5e478d...1469e50'
})
@CrabDude
CrabDude / 1_overview.md
Created April 10, 2015 19:25
Proxy Echo Server Overview

Testing