Skip to content

Instantly share code, notes, and snippets.

Brad Westfall bradwestfall

View GitHub Profile
View todo.js
import React, { useState, useRef } from 'react'
import ReactDOM from 'react-dom'
* 1. Start by creating some state to store an array of items
* where you have the array holding objects as shown below
* 2. Eventually, your array will start empty, but for now it might
* make sense to have that array already populated with an item
* or two so that way we can show them in the `<ul>`. So do that
* and then iterate over the `items` array in the JSX and make
bradwestfall /
Last active Aug 25, 2019
An explanation of why Hooks are a nicer way to abstract re-useable state and functionality vs HoC's and Render Props

HoC (pattern) vs Render Props (pattern) vs Hooks (not pattern, a new API)

Someone was asking me about comparing the HoC and Render Props patterns (and their shortcomings) to hooks. I might leave this up as a public gist for others if it's helpful.


Issues with HoC:

bradwestfall /
Last active Dec 10, 2018
AWS Beanstalk

Elastic Beanstalk Setup

Before getting started, setup a EC2 Keypair (in the EC2 section). A key can be uploaded from one that already exists, or you can create one within the web console and the private key will be downloaded (and meant to be hosted locally at ~/.ssh

  1. If uploaded, be sure to give the key the a name that prepresends the actual private key name that already exists.
  2. If downloading one AWS makes, be sure to save it at ~/.ssh and give it chmod 600 permissions. In this case the key will be a .pem key and we won't have the public file locally, just the private file.

In the creation process of the EB App, be sure to choose this keypair.

bradwestfall /
Last active Jan 15, 2018
Docker Cheat Sheet
# Build a container from a local Dockerfile
# 1. -t is the tagname
# 2. The appname is any name we want to distinguish containers
# 3. . the path to Dockerfile
docker build -t <appname> .
# List Images
docker images
# Remove an Image
bradwestfall /
Last active Jun 29, 2020
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect to
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation


View Fixing Mac, Github RSA Issue after

It seems as though some people like me are experiencing a weird thing when upgrading mac these days, the RSA keys still work for connecting to things like GitHub but my keychain doesn't want to remember the password and is annoyingly asking me for it with every git push.

The solution I found that works is at

Basically, edit my ~/.ssh/config file to be:

Host *
    UseKeychain yes
View Remove Node and NPM on OS
sudo npm uninstall npm -g
brew uninstall node


sudo rm -rf /usr/local/lib/dtrace/node.d /usr/local/lib/node_modules /usr/local/bin/npm /usr/local/bin/nodemon /usr/local/bin/node /usr/local/include/node ~/.npm* ~/.node* /usr/local/share/man/*/node* /usr/local/share/man/*/npm*
View NPM

Bump Semver -

# One of these
npm version patch -m 'Git commit message'
npm version minor -m 'Git commit message'
npm version major -m 'Git commit message'

Push to GitHub

bradwestfall / .bash_profile
Last active Jul 29, 2019
My .bash_profile
View .bash_profile
export PATH="/usr/local/mysql/bin:/usr/local/bin:~/Library/Python/2.7/bin:$PATH"
# Bash Profile
alias reload="source ~/.bash_profile"
alias profile="nano ~/.bash_profile"
# Git
alias git=hub
gc() {
View SublimeSettings.json
You can’t perform that action at this time.