Skip to content

Instantly share code, notes, and snippets.

View doeixd's full-sized avatar

Patrick G doeixd

View GitHub Profile
@doeixd
doeixd / Calculator.cs
Last active July 17, 2024 19:13
Calculator program
new App().start();
public record struct ExpressionStack(List<Expression> expression)
{
public List<Expression> stack => expression;
public Expression currentExpression => expression[expression.Count - 1];
public void add()
@doeixd
doeixd / framework.js
Last active May 13, 2024 18:37
Small Framework
var states = new WeakMap()
var remove = new WeakMap()
var setups = new WeakSet()
window.states = states
window.remove = remove
window.setups = setups
function createObserver(fn, options) {
const observer = new MutationObserver(fn);
@doeixd
doeixd / dci.ts
Created March 14, 2024 13:11
DCI TS
import { A } from "solid-start";
import Counter from "~/components/Counter";
import capitalize from "lodash.capitalize"
import { match, P } from "ts-pattern";
import { Err, Ok, Result, Option, Some, None } from "ts-results"
import type { Appearances, SubcaptionName, CaptionOverallScore, SubcaptionInitials, CaptionName, DciSeason, Competition } from "~/utils/api_types";
import { Convert } from "~/utils/api_types";
// import type Result from "ts-results"
@doeixd
doeixd / banana.md
Created February 7, 2024 19:31
banana

Banana.js logo character

Banana.js

Banana is a front-end JavaScript framework for adding interactivity to server-driven websites (Think: Astro, HTMX, eCommerce Themes, HTML templates, etc.)

Banana aims to be easily integrated into existing projects, and is mostly unopinionated about state management, templating, or styling, allowing you to pick and choose what works best for your project!

@doeixd
doeixd / SolidStartup.md
Created January 31, 2024 17:30
SolidStartup

SolidStartup inspired by Blitz.js and Vitesse

drizzle schema, postgres

uses lucia auth for auth

will generate valibot validators, trpc crud functions, and kobalte / modular forms forms, , solid-tanstack tables for tables

uses unocss, unofonts, uno icons, cva, critters, iconify

@doeixd
doeixd / inital.md
Created January 23, 2024 19:33
Behavior Elements

Behavior Elements

The worst part of using web components is dealing with the Shadow DOM, and templating in general. However when web components are just used to add small bits of interactivity to prerendered markup, they become extremely connivent, portable across frameworks/languages, easy to style, don't require immediate hydration, and do not require a custom server-side rendering step.

Behavior Elements is a simple utility function which aids in the creation of the sort of web components whose primary job is to add small bits of simple interactivity to such prerendered markup. Behavior Elements is best used in websites that are server-driven/multi page, because there is no rendering cycle, diffing, dirty-checking, global hydration, etc. it's best that all/most application state / routing reside with the server.

Behavior Elements aims to strike the balance between being simple, familiar, and easy to work with, yet still providing small additions of functionality/magic that reduces friction in common

@doeixd
doeixd / day5.mjs
Created December 5, 2023 21:16
day5.mjs
let isTest = Deno.args.join('').match(/test\d?/)?.[0]
if (isTest && !/\d/.test(isTest.split('').at(-1))) isTest += '1'
let file = await Deno.readTextFile(`./${isTest || `input`}`)
file = file.trim('').split('\n\n')
let some_seeds = file[0].split(':')?.[1].trim().split(/\s+/).map((l) => +l)
file = file.slice(1)
@doeixd
doeixd / day3.mjs
Created December 4, 2023 13:11
day3.mjs
let isTest = Deno.args.join('').match(/test\d?/)?.[0]
if (isTest && !/\d/.test(isTest.split('').at(-1))) isTest += '1'
let file = await Deno.readTextFile(`./${isTest || `input`}`)
file = file.trim('').split('\n')
let valid_parts_acc = 0
let gear_acc = 0
let part_number_map = {}
@doeixd
doeixd / framework.js
Last active January 22, 2024 20:36
framework.js
import { createContext as unCreateContext } from 'unctx'
import { createFallback, isString } from './utilities.mjs'
// Setup
export function init() {
window.__registry = {
initial_component_contexts: {},
component_instances: {}
}
@doeixd
doeixd / reset.css
Last active June 18, 2024 13:33
my css reset
@layer reset {
*, *::before, *::after { transition: all ease-in-out 100ms; margin:0; padding: 0; box-sizing: border-box; vertical-align: baseline; min-width: 0; scroll-behavior: smooth }
:root { --bodyFontSize: clamp(13.5px, calc(1.2vw * 2), 16px) }
:where(html) { text-size-adjust: none; -webkit-text-size-adjust: none; -moz-text-size-adjust: none; tab-size: 4; font-family: 'Work Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif ; color: #333; }
:where(:not(:defined)) { display: block; }
:where(:is(body, html)) { width: 100%; height: 100%; }
:where(body) { line-height: 1.5; -webkit-font-smoothing: antialiased; font-size: var(--bodyFontSize); }
:where(:is(img, picture, video, canvas, svg)) { display: block; max-width: 100%; vertical-align: middle; }
:where(:is(input, button, textarea, select)) { font: inherit; cursor: pointer; }
:where(*:not(main, body, .prose, .app, .root, #root) > :is(h1, h2, h3, h4, h5, h6)),