Skip to content

Instantly share code, notes, and snippets.

View janispritzkau's full-sized avatar

Janis Pritzkau janispritzkau

  • Germany
  • 10:54 (UTC +01:00)
View GitHub Profile
@janispritzkau
janispritzkau / README.md
Last active October 12, 2025 12:19
`on-bg` utility for Tailwind CSS emulating Material 3 state layers.
<button class="
  rounded-lg border-outline-subtle bg-container state-button p-4 text-start
  hover:on-bg-on-surface/hover active:on-bg-on-surface/active
">
@janispritzkau
janispritzkau / README.md
Last active October 12, 2025 12:44
A Tailwind CSS theme inspired by Material 3 design tokens.
<div class="m-6 w-xl rounded-xl bg-surface/90 p-6 text-on-surface shadow-xl ring ring-outline-muted">
  <h1 class="text-xl font-bold">Example</h1>

  <p class="mt-2 mb-4 text-on-surface-muted">
    My go-to Tailwind theme, which I developed by copying and pasting it into every new project
    and gradually refining it.
  </p>

 <span class="inline-block rounded-md bg-red-container px-1 font-medium text-red-on-surface"></span>
@janispritzkau
janispritzkau / vite-subset-icons-plugin.ts
Last active November 3, 2024 19:28
Material Symbols subset font plugin for Vite (reduces bundle size from megabytes to kilobytes)
import { readFile } from "node:fs/promises";
import { relative } from "node:path";
import { Minimatch } from "minimatch";
import subsetFont from "subset-font";
import { Plugin } from "vite";
export interface SubsetOptions {
codepointsPath: string;
iconsGlob: string;
@janispritzkau
janispritzkau / tailwind.config.ts
Created November 26, 2023 11:20
Tailwind Material Symbols Background Image SVG Plugin
import { Config } from "tailwindcss";
import plugin from "tailwindcss/plugin";
import { readFileSync, readdirSync } from "fs";
import { dirname, join } from "path";
export default {
// ...
plugins: [
plugin(({ addBase, theme }) => {
const colors = flattenColorPalette(theme("colors"));
@janispritzkau
janispritzkau / tailwind.config.js
Created November 23, 2023 18:04
Tailwind Config with Desaturated Grays using OKLCH
import { formatHex, oklch } from "culori";
import type { Config } from "tailwindcss";
import { gray } from "tailwindcss/colors";
export default {
content: ["index.html", "./src/**/*.{ts,tsx,vue}"],
theme: {
extend: {
colors: {
gray: Object.fromEntries(
@janispritzkau
janispritzkau / git_merge_unrelated_histories.md
Last active June 15, 2023 08:34
Merge unrelated histories in Git
  1. git checkout <original_branch>
  2. git merge <new_branch> --allow-unrelated-histories
  3. git checkout next . --force --no-overlay
  4. git commit --no-edit
abstract class Property<T = unknown> {
#values: readonly T[];
constructor(public name: string, values: readonly T[]) {
this.#values = Object.freeze(values);
}
get possibleValues(): readonly T[] {
return this.#values;
}
@janispritzkau
janispritzkau / rsa.ts
Last active November 14, 2022 17:50
Deno RSA encryption and signing with PKCS1 padding in TypeScript
import * as base64url from "https://deno.land/[email protected]/encoding/base64url.ts";
export interface RsaPrivateKey {
n: bigint;
e: bigint;
d: bigint;
p: bigint;
q: bigint;
dp: bigint;
dq: bigint;
@janispritzkau
janispritzkau / auth_puppeteer.ts
Last active November 13, 2022 19:28
Minecraft OAuth authentication using Puppeteer
#!/usr/bin/env -S deno run -A
// you might need to specify a different chrome executable because of a bug
// https://github.com/lucacasonato/deno-puppeteer/issues/65
// PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable (on my linux system)
import { OAuthClient } from "https://deno.land/x/[email protected]/auth/mod.ts";
import puppeteer from "https://deno.land/x/[email protected]/mod.ts";
const oauthClient = new OAuthClient({
@janispritzkau
janispritzkau / aes_128_cfb8.ts
Created November 8, 2022 13:56
Deno AES-128-CFB8 encryption using OpenSSL and FFI
const lib = Deno.dlopen(
Deno.env.get("DENO_SSL_PATH")!,
{
AES_set_encrypt_key: {
parameters: ["buffer", "u32", "buffer"],
result: "i32",
},
AES_cfb8_encrypt: {
parameters: [
"buffer",