Skip to content

Instantly share code, notes, and snippets.

View chrisfrazier0's full-sized avatar

Chris Frazier chrisfrazier0

View GitHub Profile
@chrisfrazier0
chrisfrazier0 / prompts.sh
Created April 19, 2025 16:15
LLM Prompt Manager
#!/usr/bin/env bash
# Configuration - default prompt path
PROMPT_PATH=~/prompts
# Override with environment variable if set
[ -n "$PROMPT_PATH" ] && PROMPT_PATH="$PROMPT_PATH"
usage() {
echo "Usage: $(basename "$0") [-h] [prompt_name] [view]"
@chrisfrazier0
chrisfrazier0 / Makefile
Created March 26, 2025 04:35
Self Documenting Makefile
# 🎯 Self-documenting Makefile template
# This Makefile provides a central place for project scripts and tasks
# Run `make` or `make help` to see available commands
# ANSI color codes for pretty output
RED=\033[0;31m
GREEN=\033[0;32m
BLUE=\033[0;34m
NC=\033[0m # No Color
@chrisfrazier0
chrisfrazier0 / component.js
Last active December 2, 2024 07:01
Native Web Components
export class Component extends HTMLElement {
render() {}
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.render();
}
attributeChangedCallback(name, _, newValue) {
if (this.state && this.state[name] !== undefined) {
@chrisfrazier0
chrisfrazier0 / mirror.sh
Last active November 16, 2024 06:46
wget mirror
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--span-hosts \
--convert-links \
--restrict-file-names=windows \
--domains website.com,assets.website.com \
--no-parent \
class AnimationLoop {
constructor({ update, render, panic, tickRate = 30, autoPause = true }) {
this.update = update
this.render = render
this.panic = panic ?? (() => this.delta = 0)
this.frameID = null
this.lastFrameMs = 0
this.lastFpsMs = 0
this.frameCount = 0
this.fps = 60
@chrisfrazier0
chrisfrazier0 / 0 custom.js
Created September 9, 2022 16:15
Custom Operators
const operations = {
'+': {
precedence: 1,
handler: (x, y) => x + y,
},
'-': {
precedence: 1,
handler: (x, y) => x - y,
},
const make_regexp = function(str, fl) {
return new RegExp(str.replace(/\s/g, ''), fl)
}
const rx_number = make_regexp(`^(?:
0 (?:
b [01]+
| o [0-7]+
| x [0-9 A-F]+
| \\. [0-9]+ (?: e [+\\-]? [0-9]+ )?
@chrisfrazier0
chrisfrazier0 / FOML.js
Created June 14, 2022 14:48
Frazier's Object Modeling Language (FOML)
/**
* Frazier's Object Modeling Language (FOML)
*
* FOML is a superset of JSON with...
* 1. Bash style comments
* 2. Root object curley braces are optional (each FOML document describes a single object)
* 3. End of line commas are optional, trailing commas are allowed
* 4. Colon (:) and equal (=) are interchangeable
* 5. Colon/equal is optional for object and array assignment
* 6. Simple property names do not require quotes (alphanumeric and _-.$@ characters only)
@chrisfrazier0
chrisfrazier0 / 0_fibonacci.b
Last active April 19, 2022 15:08
Fibonacci Brainfuck
[
main() {
return print(fib(10))
}
fib(n) {
if (n == 0) {
return 0
} else if (n == 1) {
return 1
@chrisfrazier0
chrisfrazier0 / example.js
Last active April 11, 2022 13:46
Parser Example
/*
expression = term {('+' | '-') term}
term = factor {('*' | '/') factor}
factor = base ['^' factor]
base = ['-'] value
value = number | '(' expression ')'
number = integer ['.' fractional]
integer = '0' | onenine {digit}
fractional = digit {digit}
onenine = digit - '0'