Skip to content

Instantly share code, notes, and snippets.

View joshwyatt's full-sized avatar

Josh Wyatt joshwyatt

View GitHub Profile
@joshwyatt
joshwyatt / refactoring-callback-hell.md
Created May 11, 2017 20:32
An example refactor of some callback hell code to utilize promises instead.

Organizing Multiple Asynchronous Function Calls

Using Callbacks and Continuation Passing Style

const request = require('request');

doAsyncMath('2+15', function(result) {
  doAsyncMath(`${result}*3`, function(result) {
    doAsyncMath(`${result}*10`, console.log);
@joshwyatt
joshwyatt / whiteboard_cheatsheet.md
Last active February 25, 2018 17:15
Technical Interviewing at a Whiteboard Cheatsheet

Technical Interviewing at a Whiteboard Cheatsheet

Throughout the entirety of the interview:

  • Be friendly
  • Be talking. Especially when you are not sure what to do next, or, are thinking about what you will do, you need to be sharing these thoughts with your interviewer
  • Be using eye contact to check in with your interviewer
  • Be honest (about what you've done, what you don't know)
  • Be enthusiastic about a challenge
  • Be a delightful coworker
@joshwyatt
joshwyatt / bank_account.md
Created April 26, 2017 20:11
Bank Account example for private variables accessed through getters and setters

There are situations in OOP where we may wish to protect access to instance properties.

In the following example we will make a bank account constructor in the hopes that by including a pin, will be protected.

const BankAccount = function(initialBalance, pin) {
  this.balance = initialBalance;
  this.pin = pin;
}
@joshwyatt
joshwyatt / how_to_make_a_script.md
Last active January 22, 2024 20:41
How to make scripts you can access globally from the terminal

How to make a globally available executable script in the scripting language of your choice

  • Locate the path to the interpreter for the language you are writing in with the which command.

      which node
      which python
      which bash
      which ruby
    
  • Add that path as an interpreter directive (using #!) on the first line of your script. For example if you want to write a node script and which node returned /usr/local/bin/node, the first line of your script should be:

Deploy MEAN application with Docker

Install Docker (for OS X)

(I'm not familiar with installation onto a Linux machine. Please follow the instructions on the Docker Installation page.)

[ ] If you're using OS X go directly to the boot2docker installation page, download the latest Boot2Docker pkg and install it on your laptop. This will install both Docker and Boot2Docker. The Docker installations docs have the following to say about Boot2Docker, which solves the issue for OS X users that Docker must be run on a host system with a Linux kernel.

Because the Docker daemon uses Linux-specific kernel features, you can't run Docker natively in OS X. Instead, you must install the Boot2Docker application. The application includes a VirtualBox Virtual Machine (VM), Docker itself, and the Boot2Docker management tool.