Skip to content

Instantly share code, notes, and snippets.

View jameswomack's full-sized avatar
📈

James J. Womack jameswomack

📈
View GitHub Profile
@jameswomack
jameswomack / Code.gs
Last active March 10, 2025 06:00
School-oriented AppScript Playground
const ALL_STUDENTS_SHEET_NAME = 'All Students';
const ColumnIDs = {
NAME: 0,
GRADE: 1,
SCORE: 2
};
const HEADER_ROW = JSON.stringify(["Name", "Grade", "Test Score"]);
@jameswomack
jameswomack / ServiceNowComSource.mjs
Created October 8, 2024 18:26
Root of All Eval
class ServiceNowComSource {
static sys_id = '67890';
async *#mapHistoryEntry(event) {
yield { sys_id: event.sys_id, code: `class ServiceNowComSource { static sys_id = ${event.sys_id} }`, schema_version: '12345', };
}
async *mapHistory(history) {
for (const event of history) {
yield* this.#mapHistoryEntry(event);
@jameswomack
jameswomack / ts-module-lexer.js
Created June 5, 2024 18:16
Parse imports from TypeScript files
// Use like `node ts-module-lexer.js packages/extensions/foo/src/extension.ts`
const fs = require('fs');
const path = require('path');
const ts = require('typescript');
const [_processName, _scriptName, ...args] = process.argv;
const fileName = path.basename(args[0]);
const sourceText = fs.readFileSync(args[0], 'utf8');
@jameswomack
jameswomack / History|-1022aafb|entries.json
Last active December 22, 2023 18:39
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/jameswomack/Projects/github/SportsCardInvestor/sci-api/jest.config.js","entries":[{"id":"Xi7a.js","source":"Workspace Edit","timestamp":1663784147251}]}
@jameswomack
jameswomack / nvm.zsh
Created October 16, 2023 14:47
Auto-load correct Node version in directory via nvm
autoload -U add-zsh-hook
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
@jameswomack
jameswomack / gist:d4b8b760c3c19f122903ccc83be0a2e4
Created July 21, 2023 08:08
Install the gerd-danged pnpm version from the gerd-darned package!
curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=$(node -e "console.info(require('./package.json').packageManager.match(/[0-9.]+/g)[0])") sh -
@jameswomack
jameswomack / gist:6aa5a5179ba58ffc331e1ebb5db725a7
Created July 21, 2023 07:59 — forked from lonnen/gist:3101795
git grep and git blame. two great tastes that taste great together
# from i8ramin - http://getintothis.com/blog/2012/04/02/git-grep-and-blame-bash-function/
# runs git grep on a pattern, and then uses git blame to who did it
ggb() {
git grep -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
# small modification for git egrep bash
geb() {
git grep -E -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
@jameswomack
jameswomack / autoload-for-zshrc.zsh
Created June 2, 2023 20:44
Auto-load correct Node version from directory based on .nvmrc
autoload -U add-zsh-hook
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
@jameswomack
jameswomack / gist:813d70c72c2125e2b038294a753091b4
Created November 21, 2017 17:13 — forked from ivan-loh/gist:ee0d96c3795e59244063
Node.JS ( & pm2 ) Process Memory Limit
# Plain Ol' Node
node --max-old-space-size=1024 app.js # increase to 1gb
node --max-old-space-size=2048 app.js # increase to 2gb
node --max-old-space-size=3072 app.js # increase to 3gb
node --max-old-space-size=4096 app.js # increase to 4gb
node --max-old-space-size=5120 app.js # increase to 5gb
node --max-old-space-size=6144 app.js # increase to 6gb
# For pm2
pm2 start app.js --node-args="--max-old-space-size=1024" # increase to 1gb
@jameswomack
jameswomack / accept-all-invites.scpt
Created November 27, 2021 17:10
Accept every calendar event in Outlook Mac using AppleScript
tell application "Microsoft Outlook"
repeat with calendarEvent in the every calendar event
accept meeting calendarEvent
end repeat
end tell