Skip to content

Instantly share code, notes, and snippets.

View fitsum's full-sized avatar
💭
npx fitsum

ፍፁም fitsum

💭
npx fitsum
View GitHub Profile
/*
Web component code gen from Gemini Pro
Original code: https://codepen.io/cassidoo/pen/RNrqOOO
Related social media post: https://bsky.app/profile/did:plc:bhdap3w2bseikypfnjmaskzf/post/3m4pb4lz6ss24
*/
class RevealImage extends HTMLElement {
// --- Define default values ---
radius = 100;
bigRadius = 200;
@fitsum
fitsum / git-log-short.txt
Created December 8, 2024 21:17
minimal git log with hash, author, date, message
git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
@fitsum
fitsum / trinket-pro-arduino-cli-sample.md
Last active March 3, 2024 05:16
sample cli command for compiling and uploading to trinket pro with required args|props|...

commands

  • arduino-cli compile --fqbn adafruit:avr:protrinket5 [project name]
  • arduino-cli upload -P usbtinyisp --fqbn adafruit:avr:protrinket5 [project name]

pre-reqs

  • arduino-cli core install adafruit:avr
  • (linux) arduino-cli core install arduino:avr
  • (linux, maybe) install udev rules for trinket pro + restart udev
@fitsum
fitsum / speak-english.js
Last active April 26, 2024 05:18
speaks english voices in given browsers
speakEnglish = () => { voices = speechSynthesis.getVoices(); voices.filter(voice => voice.lang === "en-US" ).forEach(voice => {
const utterance = new SpeechSynthesisUtterance("What's poppin, bitches?")
utterance.voice = voice;
// default volume !== 1
utterance.volume = 1;
speechSynthesis.speak(utterance);
// next line causes function not to fire on first invocation 🤷🏾‍♂️
utterance.addEventListener('start',()=>{console.log('voice name:', voice.name)})
}) }
speakEnglish()
@fitsum
fitsum / remove-youtube-likes.js
Last active April 26, 2024 05:19
removing likes from youtube clips until YT baffles the effort
// https://www.youtube.com/playlist?list=LL
let currentLike = 1,
// should allow time for menu open and click
removeDelay = 150,
// should be double remove delay
countDelay = removeDelay*2,
// get current total from stats section
totalLikes = parseInt(document.querySelector('#stats yt-formatted-string').textContent);
const countLikes = setInterval(()=>{
/*** The new CSS Reset - version 1.2.0 (last updated 23.7.2021) ***/
/* Remove all the styles of the "User-Agent-Stylesheet", except for the 'display' property */
*:where(:not(iframe, canvas, img, svg, video):not(svg *)) {
all: unset;
display: revert;
}
/* Preferred box-sizing value */
*,
@fitsum
fitsum / same-as-eval.js
Last active April 26, 2024 05:20
no more eval() I guess ...
(() => {return Function(`"use strict";return (${__f__})`)();}).call(null)()
// would normally do `eval(__f__)` where __f__ might be a stringified function
// name in an array
@fitsum
fitsum / scratchmarklet.js
Created November 22, 2020 04:15
bookmarklet version of scratch.js
data:text/html, <html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>*scratch*</title><style> body{font-family:Hack,Menlo,Monaco,'Droid Sans Mono','Courier New',monospace;white-space:pre}body style{display:inline}style::before{content:'<style>'}style::after{content:'<\/style>'}*::before,*::after{color:rgba(136,18,128,0.5)}</style><script> const selectOuterMostNonBodyNode = (node) => node.parentNode.tagName === 'BODY' ? node : node.parentNode;function insertAfterSelection(selection,html){if(html === '') return;let nodeToInsert=document.createElement('div');nodeToInsert.innerHTML=html + '<br>';let range=selection.getRangeAt(0);let clone=range.cloneRange();let {endContainer} = range;range.setStartAfter(selectOuterMostNonBodyNode(endContainer)); range.insertNode(nodeToInsert);clone.setStart(clone.endContainer, clone.endOffset);selection.removeRange(range); selection.addRange(clone);} var globalEval=eval;function evaluate(){let selection=documen
@fitsum
fitsum / amharic.txt
Created October 29, 2020 02:28
my name in amharic in unicode
console.log('\u134D\u1341\u121D\u1361\u1260\u12AB\u12ED') // "ፍፁም፡በካይ"
@fitsum
fitsum / ASCIIcade.txt
Last active October 6, 2020 20:59
based on fun cascading thing I used to do manually on twitter
// OG
// https://jsfiddle.net/fitsum/40t8h2no/
// params
s:String = string
f:String = filler character
e:String = effect name; eg. "rev", "zig"
w:Number = horizontal spacing
const ASCIIcade = (s, f = null, e = null, w = 3) => {