Skip to content

Instantly share code, notes, and snippets.

John Grimes johngrimes

Block or report user

Report or block johngrimes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@johngrimes
johngrimes / .prettierrc.json
Created May 5, 2018
My Prettier configuration
View .prettierrc.json
{
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "always"
}
@johngrimes
johngrimes / macos-10133-fail.md
Last active Jul 25, 2019
macOS 10.13.3 Update FAIL
View macos-10133-fail.md

I had some massive problems when installing the 10.13.3 update on macOS. The update installed, my computer successfully restarted - but on a subsequent restart the boot failed and displayed the following installation log:

Apr  4 04:07:04 MacBook-Pro opendirectoryd[186]: [session] Processing a network change notification
Apr  4 04:07:06 MacBook-Pro Unknown[526]: Launching the Language Chooser for an OS Install
Apr  4 04:07:06 MacBook-Pro bspowerassertiontool[521]: Tool exited successfully (0).
Apr  4 04:07:06 MacBook-Pro launchprogresswindow[524]: ISAP: Show progress UI called
Apr  4 04:07:07 MacBook-Pro Installer Progress[180]: Progress UI App Starting
Apr  4 04:07:32 MacBook-Pro opendirectoryd[186]: [session] Received a network change notification
Apr  4 04:07:32 MacBook-Pro opendirectoryd[186]: [session] Received a network change notification
View distributed-git-ftw.md

Make a bare repo from a checkout:

git clone --bare /path/to/repo

Then run this in the bare git repo:

touch git-daemon-export-ok
@johngrimes
johngrimes / davmail-launchd.md
Last active Feb 22, 2018
Keep DavMail running with launchd
View davmail-launchd.md

Keep DavMail running with launchd

Create the following file at ~/Library/LaunchAgents/net.sourceforge.davmail.agent.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>Label</key>
@johngrimes
johngrimes / recordRelease.sh
Created Feb 14, 2018
Recording releases with Sentry and Create React App
View recordRelease.sh
#!/bin/bash
VERSION=$(git rev-parse HEAD)
yarn run sentry-cli releases -p $SENTRY_PROJECT new $VERSION && \
yarn run sentry-cli releases -p $SENTRY_PROJECT set-commits --auto $VERSION && \
yarn run sentry-cli releases -p $SENTRY_PROJECT files $VERSION upload-sourcemaps --url-prefix https://$TARGET_HOSTNAME/static/js build/static/js && \
yarn run sentry-cli releases -p $SENTRY_PROJECT deploys $VERSION new --env $TARGET_HOSTNAME
@johngrimes
johngrimes / nginx.conf
Created Feb 14, 2018
Ideal Nginx configuration for JavaScript single-page app
View nginx.conf
server {
listen 80;
root /usr/share/nginx/html;
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
gzip_comp_level 9;
etag on;
location / {
try_files $uri $uri/ /index.html;
}
@johngrimes
johngrimes / Dockerfile
Created Feb 14, 2018
Injecting environment variables into config.json using Docker
View Dockerfile
FROM nginx
COPY docker/start.sh /
COPY docker/buildConfig.sh /
RUN chmod +x /start.sh /buildConfig.sh
COPY docker/myapp.nginx.conf /etc/nginx/conf.d/default.conf
COPY build /usr/share/nginx/html
ENV MYAPP_OPTION_A="Default option A value"
@johngrimes
johngrimes / formatStagedFiles.sh
Created Feb 14, 2018
Format staged files with Prettier before commit
View formatStagedFiles.sh
#!/bin/bash
STAGED=$(git diff --name-only --cached --diff-filter=AM | egrep '^(.*).(js|json|css)$')
yarn prettier --write $STAGED
git add $STAGED
View deregister-service-workers.md

De-registers any service workers, if the browser supports service worker and if there are any present.

if (navigator.serviceWorker) {
  navigator.serviceWorker.getRegistrations().then(function(registrations) {
    for (let registration of registrations) {
      registration.unregister()
    }
  })
}
@johngrimes
johngrimes / generating-local-certs.md
Last active Feb 6, 2018
Generating a local CA and certificates
View generating-local-certs.md

Generating a local CA and certificates

Create this file as [hostname].ext

authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage=digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName=@alt_names
You can’t perform that action at this time.