Skip to content

Instantly share code, notes, and snippets.

View graup's full-sized avatar

Paul Grau graup

View GitHub Profile
try {
const result = await timedAsync(originalAsyncFunction, {
slow: () => {
console.log('operation is slow and still going on'):
},
fast: () => {
console.log('operation finished quickly'):
}
});
} catch (e) {
@graup
graup / Animated SVG to WEBP.md
Last active February 12, 2025 13:51
Convert animated SVG into animated WEBP

We use playwright to capture screenshots of our animated SVG (or really anything that can be loaded into a browser), then use sharp to convert pngs into webps, then node-webpmux to create the animated webp.

  1. Install dependencies
  2. yarn ts-node capture.ts
  3. yarn ts-node writeWebP.ts