Skip to content

Instantly share code, notes, and snippets.

View jamsinclair's full-sized avatar
👣
They say good code starts from the feet

Jamie jamsinclair

👣
They say good code starts from the feet
View GitHub Profile
@jamsinclair
jamsinclair / plugin.js
Last active December 4, 2023 15:03
Experimental Vite plugin to not bundle module workers and chunk them instead (vitejs/vite issue #7015)
const MODULE_WORKER_REGEX =
/new\s+Worker\s*\(\s*new\s+URL\s*\(\s*["'](.*?)["']\s*,\s*import\.meta\.url\s*\)\s*,\s*\{\s*type\s*:\s*["']module["']\s*\}\s*\)/g;
const TEMPORARY_DYNAMIC_IMPORT_REGEX =
/\/\*__TEMP_WORKER__\*\/__vitePreload\(\(\) => import\((['"])(.+?)\1\),.*?\)/g;
const hasNoPathPrefix = (path) => !/^[\./]|^file:|^https?:/.test(path);
export default function moduleWorkerChunkPlugin() {
return {
name: "module-worker-chunk-plugin",
@jamsinclair
jamsinclair / trace-next-11
Created November 24, 2021 02:12
Next 11 vs Next 12 Build Traces
This file has been truncated, but you can view the full file.
[{"traceId":"0c02b189e403be4d","parentId":"5281e8e6dd2655cd","name":"generate-buildid","id":"6e38d0cfa754a7dd","timestamp":3801425212701,"duration":290,"tags":{}},{"traceId":"0c02b189e403be4d","parentId":"5281e8e6dd2655cd","name":"load-custom-routes","id":"1801e5e5ed719376","timestamp":3801425213137,"duration":4931,"tags":{}},{"traceId":"0c02b189e403be4d","parentId":"5281e8e6dd2655cd","name":"verify-typescript-setup","id":"ade6c0a7905f3959","timestamp":3801425282726,"duration":3230822,"tags":{}},{"traceId":"0c02b189e403be4d","parentId":"5281e8e6dd2655cd","name":"verify-and-lint","id":"8bbac50eb5edc6cc","timestamp":3801428515609,"duration":3855514,"tags":{}},{"traceId":"0c02b189e403be4d","parentId":"5281e8e6dd2655cd","name":"collect-pages","id":"c151a80e7416f529","timestamp":3801432389508,"duration":59819,"tags":{}},{"traceId":"0c02b189e403be4d","parentId":"5281e8e6dd2655cd","name":"create-pages-mapping","id":"a8b2a3c1982514a6","timestamp":3801432449415,"duration":487,"tags":{}},{"traceId":"0c02b189e403be4d","
@jamsinclair
jamsinclair / .zshrc
Created February 16, 2021 01:40
Lazy Load NVM (node npm, npx, yarn)
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
@jamsinclair
jamsinclair / .zsh_plugins.txt
Last active June 8, 2022 04:54
ZSH Macbook Setup
# Place this file in the user's dir "~/."
# Add ZSH Plugins here (See: https://getantidote.github.io/usage)
ohmyzsh/ohmyzsh path:plugins/git
zsh-users/zsh-syntax-highlighting

Keybase proof

I hereby claim:

  • I am jamsinclair on github.
  • I am jamsinclair (https://keybase.io/jamsinclair) on keybase.
  • I have a public key whose fingerprint is 9090 FEFF 4AB2 26CC 8842 A2EF 1661 6B04 F587 C018

To claim this, I am signing this object:

@jamsinclair
jamsinclair / .editorconfig
Created November 10, 2016 10:34
fav-editorconfig
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@jamsinclair
jamsinclair / aws-minecraft-setup.sh
Last active May 24, 2022 05:25
A bash script to setup a simple Minecraft Server on an AWS Micro EC2 Instance. Installs server, configures cron to run server on reboot, adds some aliases for easy stop/start of minecraft server.
#!/bin/sh
runMinecraftCommand="java -Xms256M -Xmx768M -jar minecraft_server.jar nogui"
startScript="start.sh"
echo "Great let's get minecraft setup!"
# Sanity check, do we have java installed?
if ! hash java 2>/dev/null; then
echo "You don't have java installed. You're gonna have a tough time."
echo "Are you sure you selected the default Amazon Linux HVM ami?"
@jamsinclair
jamsinclair / shrug.md
Last active July 19, 2022 06:34
Markdown Escaped Shrug

¯\_(ツ)_/¯