Skip to content

Instantly share code, notes, and snippets.

View bennypowers's full-sized avatar
🇮🇱
עם ישראל חי

Benny Powers - עם ישראל חי! bennypowers

🇮🇱
עם ישראל חי
View GitHub Profile
function setScoreTo(num: number) {
serial.writeValue("score", num)
if (num >= 4) {
win()
} else if (num < 0) {
lose()
} else {
last = rounded
rope = num
rounded = Math.round(rope)
@bennypowers
bennypowers / process.js
Last active July 11, 2023 14:55
Transform a specific instance of shadow CSS to a light dom sheet, with private knowledge of the shadow dom
import postcss from 'postcss';
import { readFile } from 'node:fs/promises';
// load up the shadow dom css sheet,
// taken from the rhds git repo
const content = await readFile(new URL('./rh-cta.css', import.meta.url), 'utf-8');
const HOST_ARGS = /:host\((?<hostArg>[^)]*)\)/g;
const SLOTTED_ARGS = /::slotted\((?<slottedArg>[^)]*)\)/gm;
@bennypowers
bennypowers / am-yisrael-hai.html
Last active October 10, 2023 13:55
Am Yisrael Hai Web Component
<am-yisrael-hai>
<template shadowrootmode="open">
<!-- @license public domain -->
<!-- @author bennypowers.dev -->
<style>
:host {
display: contents;
text-align: center;
font-size: 150%;
}