Skip to content

Instantly share code, notes, and snippets.

View maekoos's full-sized avatar

Markus Stensiö maekoos

  • Göteborg
  • 11:30 (UTC +02:00)
View GitHub Profile
@maekoos
maekoos / convert.py
Created May 12, 2025 17:49
Convert cllor swatches/palettes from GIMP (.gpl) to Adobe (.ase)
import swatch
colors = []
with open("input.gpl", "r") as f:
# Skip "GIMP Palette" and "Name:"
lines = f.readlines()[2:]
for ln in lines:
if ln.startswith("#"):
continue
@maekoos
maekoos / htmx-toast.js
Last active January 7, 2025 18:55
Server sent toasts in HTMX
htmx.on("htmx:afterRequest", (e) => {
const toast = e.detail.xhr.getResponseHeader('HX-Toast');
// Can be expanded with HX-Toast-Type or similar to specify success, warning, info, etc
if(toast) {
const el = document.createElement('span');
el.innerText = toast;
el.style.position = 'fixed';
el.style.top = '10px';
// Right aligned:
// el.style.right = '10px';