Skip to content

Instantly share code, notes, and snippets.

View orinokai's full-sized avatar

Rob Stanford orinokai

View GitHub Profile
@orinokai
orinokai / middleware.js
Last active November 3, 2022 11:46
Next.js Advanced Middleware Transforms with Query Params and Prop Lookups
import { MiddlewareRequest } from "@netlify/next";
export async function middleware(nextRequest) {
const pathname = nextRequest.nextUrl.pathname;
const request = new MiddlewareRequest(nextRequest);
if (pathname.startsWith("/static")) {
const unit = nextRequest.nextUrl.searchParams.get("unit");
const response = await request.next();
@orinokai
orinokai / osx-install
Created April 4, 2014 08:54
Setting up a clean OS X install
Download installer from App Store (don't proceed with installation)
Insert 8Gb SD card
Open Disk Utility
Ensure card is formatted with 1 'GUID Partition Table' partition
Ensure the partition is named 'BOOT'
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/BOOT --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
Reboot, holding down the option key
Boot to the SD card
@orinokai
orinokai / droplet-setup
Last active May 19, 2016 21:01
Setting up a DigitalOcean Droplet for LAMP
Select hostname, droplet size and location
Select LAMP application image
Receive new droplet email for IP and password
Log in with
ssh root@[ip address]
Change MYSQL password to match root
mysqladmin -u root -p'password' password [new password]
Create MYSQL superuser
mysql -u root -p[password]
CREATE USER '[username]'@'localhost' IDENTIFIED BY '[password]';