Skip to content

Instantly share code, notes, and snippets.

View colorincode's full-sized avatar

Kayla B colorincode

  • Color in code
View GitHub Profile
import gsap from "https://esm.sh/gsap";
import { TextPlugin } from "https://esm.sh/gsap/all";
import { EasePack } from "https://esm.sh/gsap/EasePack";
import confetti from "https://esm.sh/canvas-confetti";
gsap.registerPlugin(TextPlugin, EasePack);
let currentStep = 1;
const totalSteps = 10;
const quizData = {};
import { serve, HTMLBundle, Server } from "bun";
import { watch } from "fs";
import { join } from "path";
import { buildProject, runBuild} from "./bun_build";
import { URL } from "url";
// const clients = new Set<new WebSocket("ws://localhost:8080")>;
let hostname = "localhost";
// this is an intersection observer in cases where you have video that is outta focus
function setupVideoObservers() {
const videos = document.querySelectorAll('.some-video');
let currentVideo: HTMLVideoElement | null = null;
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const video = entry.target as HTMLVideoElement;
if (entry.isIntersecting) {
video.play();
@colorincode
colorincode / gist:82afeb4ca187d36de14390ddf53065b9
Created September 11, 2024 16:36
Concepts for blocking AI bot scraping
# not for you mr robot
## Google Fam
# -----------------
User-agent: Googlebot
User-agent: Mediapartners-Google
Disallow: /*/feed
Disallow: /?s=
## Other SE
<!--////////////////////////////////////////////////////////////////////////////////////////
/// ///
/// Example Using Three.js Library, HTML, CSS & JavaScript ///
// 3D Interactive Web Apps & Games 2021-2024 ///
/// Contact Shane Brumback https://www.shanebrumback.com ///
/// Send a message if you have questions about this code ///
/// I am a freelance developer. I develop any and all web. ///
/// Apps Websites 3D 2D CMS Systems etc. Contact me anytime :) ///
/// ///
////////////////////////////////////////////////////////////////////////////////////////////-->
// leaving as-is for now
function factorial(n: bigint, x = 1n): bigint {
if (n <= 1) return x;
return factorial(n - 1n, n * x);
}
function factorialAux(n: bigint, x = 1n): bigint | Thunk<bigint> {
if (n <= 1) return x;
return () => factorial(n - 1n, n * x);
}
@colorincode
colorincode / tramp.ts
Created July 11, 2024 18:57 — forked from trvswgnr/tramp.ts
trampoline typescript
/**
* Transforms a function that returns either a direct value or a thunk (a
* no-argument function that returns a value) into a function that only returns
* a direct value. It does this by repeatedly evaluating the function if it
* returns a thunk, until a direct value is obtained.
*
* @template T The type of the value to be returned by the trampoline function.
* @template A The type tuple representing the argument types accepted by the
* function `f`.
* @param f A function that takes arguments of type `A` and returns either a
const { readFileSync, statSync, existsSync } = require('fs')
const mime = require('mime')
const CSSAsset = require(`parcel-bundler/${parseInt(process.versions.node, 10) < 8 ? 'lib' : 'src'}/assets/CSSAsset`)
const { dirname, join, resolve, extname, normalize, relative } = require('path')
const projectRootPath = resolve(__dirname, '../../../')
const parcelrcPath = join(projectRootPath, '.parcelrc')
const getConfig = () => existsSync(parcelrcPath) ? JSON.parse(readFileSync(parcelrcPath))['css-url-loader'] : {}
const EXTS = ['png', 'svg', 'jpg', 'gif', 'jpeg']