Skip to content

Instantly share code, notes, and snippets.

View AlanGreene's full-sized avatar

Alan Greene AlanGreene

View GitHub Profile
@AlanGreene
AlanGreene / dock.sh
Created April 19, 2020 16:52 — forked from kamui545/dock.sh
Customize macOS dock via command line
#!/usr/bin/env bash
source "./dock_functions.sh"
declare -a apps=(
'/System/Applications/Utilities/Terminal.app'
'/System/Applications/Music.app'
'/Applications/Google Chrome.app'
'/Applications/PhpStorm.app'
'/Applications/Visual Studio Code.app'
@AlanGreene
AlanGreene / git-branch-to-favicon.js
Created April 5, 2020 13:34 — forked from tigt/git-branch-to-favicon.js
Creates an SVG string that can be used as a favicon across different Git branches. Actually getting this into the browser is sadly project-specific.
const { execSync } = require('child_process')
const { createHash } = require('crypto')
const invertColor = require('invert-color')
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
const hash = createHash('sha256')
hash.update(branchName)
const color = '#' + hash.digest().toString('hex').substring(0, 6)
const invertedColor = invertColor(color, true)
@AlanGreene
AlanGreene / reactChaosMonkey.js
Created August 22, 2019 00:06
How to make your React apps more error resistant
// from @PhilippSpiess
if (process.env.NODE_ENV === 'development') {
const originalCreateElement = React.createElement;
React.createElement = function(...args) {
if (Math.random() < 0.001) { // adjust as desired
throw Error('A random error ocurred. Did an error boundary properly catch it?');
}
return originalCreateElement.call(React, ...args);
};
@AlanGreene
AlanGreene / setupTests.js
Created August 21, 2019 23:56
jest - detect unmocked network requests
// from @kentcdodds
beforeEach(() => {
jest.spyOn(window, 'fetch').mockImplementation((...args) => {
console.warn('window.fetch is not mocked for this call', ...args);
throw new Error('This must be mocked!');
});
});
afterEach(() => {
window.fetch.mockRestore();
@AlanGreene
AlanGreene / blur-prank.user.js
Created March 13, 2019 23:10 — forked from sindresorhus/blur-prank.user.js
Blur prank UserScript
// ==UserScript==
// @name Dictionary
// @version 0.1
// @author Sindre Sorhus
// @include *
// ==/UserScript==
document.documentElement.style.webkitFilter='blur(0.5px)';

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your o

Keybase proof

I hereby claim:

  • I am AlanGreene on github.
  • I am alangreene (https://keybase.io/alangreene) on keybase.
  • I have a public key whose fingerprint is 9052 081F 91C1 81BB 2CF3 B16C F20F 197F 61B0 D3C5

To claim this, I am signing this object: