This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
section: screens | |
desktop: | |
laptop: | |
end | |
section: aliases | |
desktop: | |
Williams-Mac-Pro.local | |
laptop: | |
will.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove the heads off arrays of base_64 encoded datauris | |
# | |
# in this example we take the array of images encoded from | |
# whammy.js and return an array without the heads. This is | |
# an admittedly vain optimization but, every byte counts. | |
Base64Header = (type) -> | |
head: "data:#{type};base64," | |
add: (string) -> | |
"#{HEAD}#{string}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CHECKING_OUT_BRANCH=$3 | |
OLD_BRANCH=$1 | |
NEW_BRANCH=$2 | |
if [ $CHECKING_OUT_BRANCH -eq 1 ] | |
then | |
FILES_CHANGED=`git diff $OLD_BRANCH $NEW_BRANCH --name-status` | |
MIGRATIONS_REMOVED=`echo "$FILES_CHANGED" | egrep 'D\tdb/migrate/([0-9]+)' | sort -r` | |
MIGRATIONS_ADDED=`echo "$FILES_CHANGED" | egrep 'A\tdb/migrate/([0-9]+)'` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will install a Git pre-push hook that prevents force pushing the master/main branch. | |
# There are three variants that I have built: | |
# - pre-push: prevents force-pushing to master/main. | |
# - pre-push-2: prevents force-pushing to master/main depending on the remote (you need to edit the file!). | |
# - pre-push-3: prevents any type of pushing to master/main. | |
# Set the desired version like this before proceeding: | |
# FILE=pre-push | |
# Single repo installation: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find the longest words you can type, alternating hands at each character. Y and B excluded. | |
egrep "^[$right]?([$left][$right]){6,}[$left]?\$" /usr/share/dict/words | |
# Qwerty | |
left=qwertasdfgzxcv | |
right=uiophjklnm | |
# Colemak | |
left=qwfpgarstdzxcv |
Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.
I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a
beforeEach
. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern
that gives great defaults for each test example but allows every example to override props
when needed: