Skip to content

Instantly share code, notes, and snippets.

@nbogie
nbogie / bookmarklet-make-TOC-for-p5-tutorial.js
Created January 10, 2026 19:59
make an insert a rough ToC for p5 tutorials.
javascript:(function(){
const main = document.querySelector('main');
const headers = document.querySelectorAll('h1, h2');
if (!main || headers.length === 0) return;
const ol = document.createElement('ol');
ol.style.cssText = 'background:#f4f4f4; border:1px solid #aaa; padding:20px 40px; margin-bottom:20px; font-family:sans-serif;';
headers.forEach((h, i) => {
@nbogie
nbogie / powershell-folder-sizes.txt
Created December 12, 2025 00:07
powershell script to list folders and their sizes - LLM generated - not reviewed
# Define the path to scan (use "." for the current directory)
$PathToScan = "."
Get-ChildItem -Path $PathToScan -Directory -ErrorAction SilentlyContinue |
ForEach-Object {
# Calculate the size of the current folder and its contents
$SizeInBytes = (Get-ChildItem -Path $_.FullName -Recurse -ErrorAction SilentlyContinue |
Measure-Object -Property Length -Sum).Sum
# Convert bytes to Megabytes (MB)

here's what you get when you start to load global.d.ts and then index.d.ts from definitely typed.

flowchart LR
    Z("global.d.ts")
    A("index.d.ts")

    Z --> A

    subgraph Root Files

Feedback for beta.openprocessing.org changes rollout (oct 2025)

minor: variables hyperlink to any method documentation with same name

Example:

In the following, x will link to docs for p5.Vector.x, and heading will link to docs for p5.Vector.heading.

@nbogie
nbogie / MyExampleProcessingApp.java
Created October 31, 2024 17:56
Example Processing java (for outside of Processing)
import processing.core.PApplet;
public class MyExampleProcessingApp extends PApplet {
public static void main(String[] args) {
System.out.println("MyExampleProcessingApp main() started");
// The string must match your full class name:
PApplet.main(new String[] { "MyExampleProcessingApp" });
class Point {
x: number;
y: number;
/** the label for this point */
label: string;
constructor(givenLabel: string,givenX: number, givenY:number){
console.log("constructor was called")
this.x = givenX;
@nbogie
nbogie / adventOfCodeTemplate.js
Created December 2, 2022 10:05
JavaScript (not TypeScript) starter for advent of code solutions in node.js
const fs = require('fs/promises');
async function readFileAndSolveProblem() {
const inputRaw = await fs.readFile("./inputs/inputDay1A.txt", { encoding: 'utf8' })
const inputLines = inputRaw.split("\n");
console.log({ inputLines })
//TODO: solve the problem here, based on inputLines
}
@nbogie
nbogie / adventOfCodeTemplate.ts
Last active December 2, 2022 10:06
TypeScript starter function for advent of code
import fs from 'fs/promises';
async function readFileAndSolveProblem() {
const inputRaw = await fs.readFile("./inputs/inputDay1A.txt", { encoding: 'utf8' })
const inputLines: string[] = inputRaw.split("\n");
console.log({ inputLines })
//TODO: solve the problem here, based on inputLines
}
type Player = "X" | "O"
type PosState = Player | ""
type BoardState = [
PosState,PosState,PosState,
PosState,PosState,PosState,
PosState,PosState,PosState
]
//type WinState = "draw" | "X won" | "O won" | "not finished"