Image for post
Image for post

Breadth-First and Depth-First Search with Asynchrony

When I first started really digging into advanced Comp Sci topics, graph theory and recursion were two that I felt like I’d never get. Like most things, though, it was just a matter of time and practice before I felt at least a little more comfortable with them.

Today I worked through an especially tough challenge. Here it is:

Write a Node.js program that, given a relative directory path, will return a list of all files in all folders and subfolders inside of that directory.

For example, imagine a directory tree:

| |-- foo
| | |-- a
| | | +-- Hello.txt
| | | +-- World.txt
| | |-- b
| | | +-- Dude.js
| | |-- c
| | | +-- Sweet.js
| | +-- hey.js
| |-- bar
| | +-- baz.js
| +-- ho.js …

Image for post
Image for post
Handle errors like a boss

Everyone knows that gracefully handling errors in your application is important. But sometimes, especially when you’re developing at the startup pace, it’s easy to put it aside for later while you work on… well, getting things to work.

I finally got a chance to start refactoring an application I built a few months ago. Among many sweet-baby-Jesus-did-I-actually-write-that-awful-code? moments, I noticed that my error handling was generally pretty weak — a popup here or console.log there. Now with a couple more months of experience under my belt, and a much stronger understanding of OOP, I knew I could better.

Step One: Outline The Requirements

First, I wanted to identify common elements in error handling so that I could keep my code as DRY as possible. Here’s the list I came up…

Image for post
Image for post

Today I tackled a tough problem — file uploads with MongoDB and GridFS. The tricky part wasn’t so much the file uploading part, but rather the putting it all together. I found a lot of resources for individual pieces of the puzzle, and figured it’d be good to share what I learned about the whole picture.

The Goal

I needed to allow a user to upload a pdf file and store it in MongoDB. Later I’d need to retrieve that file and display it on the client again somehow. The app was MEAN stack with Angular 1.5 and the usual suspects. …

Image for post
Image for post

(Ported over from my previous blog)

Last week at Coding House, some of us chose to create a web app using React. Our group made a forum for prospective or current students and alumni of dev bootcamps to ask questions and share their experiences. Check it out here.

Listening to some of the frustrations from the other teams as well as working through our own issues during the project, I thought that doing a little Flux flow tutorial would be beneficial. I’ll use Robbie McLellan’s SwordOfTheNinja template to start out, which you can find here. I like to use it whenever I start React projects because it has all the essentials for creating a full stack React app like babel and jspm without any unnecessary sugar. …


Patrick Shaughnessy

Full Stack Javascript Developer. Student of life.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store