Skip to content

Instantly share code, notes, and snippets.

View leobm's full-sized avatar

Felix Wittmann leobm

  • Hamburg, Germany
View GitHub Profile
@leobm
leobm / istspahnnochimamt-widget.js
Created August 6, 2025 07:48
www.istspahnnochimamt.de mini Widget für die eigenen Webseite
(function() {
const e = document.createElement("style");
e.textContent = `.spahn-widget{background-color:#7c86ff;color:#fff;font-family:-apple-system,BlinkMacSystemFont,'SegoeUI',Roboto,Oxygen,Ubuntu,sans-serif;max-width:600px;padding:2rem;margin:1rem
auto;text-align:center;border-radius:8px}.spahn-widget h1{font-size:4rem}.spahn-widget .answer{font-size:3rem;font-weight:bold;margin-bottom:1rem}.spahn-widget .description{font-size:1.5rem;line-height:1.4}`;
document.head.appendChild(e);
const t = document.createElement("div");
t.className = "spahn-widget", t.innerHTML = `<h1>Ist Spahn noch im Amt?</h1><div class="answer" id="spahn-answer">Lade...</div><div class="description" id="spahn-description"></div>`, document.body.appendChild(t), fetch("https://istspahnnochimamt.de/api/v1/inOffice").then(e => e.json()).then(e => {
document.getElementById("spahn-answer").textContent = e.isSpahnStillInOffice ? "Leider ja" : "Endlich Nein 🥳", document.getElementById("spahn-description").innerHTM
@leobm
leobm / snake.bas
Created April 25, 2025 13:26
Amstrad CPC, simple snake, locomotive basic
10 MODE 1:INK 0,0:INK 1,19:PAPER 0: PEN 1:CLS
20 w=40: h=25: l=5
30 dx=1: dy=0
35 PEN 2
40 FOR xw=1 TO w
50 LOCATE xw,1: PRINT "#"
60 LOCATE xw,h: PRINT "#";
70 NEXT
80 FOR yh=1 TO h
90 LOCATE 1,yh: PRINT "#";
@leobm
leobm / chain.st
Created December 20, 2024 17:41 — forked from zeroflag/chain.st
Object>>chain
^ ChainProxy new setTarget: self
ChainProxy>>doesNotUnderstand: aMessage
target := aMessage sendTo: target.
^ target
ChainProxy>>setTarget: anObject
target := anObject.
^ self
@leobm
leobm / main.rs
Created December 17, 2024 13:46
Optional Parameters in Rust, different methods
#[allow(dead_code)]
fn f1(a: i32) -> i32 {
a
}
#[allow(dead_code)]
fn f2(a: i32, b: i32) -> i32 {
a+b
}
#[allow(dead_code)]
@leobm
leobm / avg.rs
Created December 17, 2024 13:39 — forked from jnordwick/avg.rs
count, sum, and avg macros in rust
macro_rules! avg {
($($t:expr),*) => (sum!($($t),*)/count!($($t),*));
}
macro_rules! count {
($h:expr) => (1);
($h:expr, $($t:expr),*) =>
(1 + count!($($t),*));
}
@leobm
leobm / main.gleam
Last active December 17, 2024 13:50
A Writer Interface in gleam
import writer
import string_writer
pub fn main() {
string_writer.create()
|> writer.write("Text1")
|> writer.write("Text2")
|> string_writer.print()
}
@leobm
leobm / my_app.ex
Created January 4, 2023 21:35 — forked from alanpeabody/my_app.ex
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@leobm
leobm / ruby-fmt.clj
Created December 19, 2022 01:44 — forked from fogus/ruby-fmt.clj
Ruby-like string interpolation in Clojure
; Ruby has an awesome feature -- string interpolation. Read about it on the internet.
; On the other hand, Clojure only has cumbersome Java string formatting, which can not be
; used without pain after you've tried Ruby.
; So here's this simple macro that basically allows you to do most things you could do
; with Ruby string interpolation in Clojure.
(ns eis.stuff
(:require [clojure.string]))
@leobm
leobm / youtube_comments_deleter.js
Last active July 29, 2021 10:33
Delete youtube comments activity
// ==UserScript==
// @name Delete youtube comments activity
// @version 1
// @grant none
// @include https://myactivity.google.com/page*
// ==/UserScript==
const DELETE_MAX_ENTRIES_AFTER_PAGE_RELOAD = 1;
(function(d) {
module Main where
import Prelude
import Control.Monad.Reader (Reader, runReader, ReaderT(..), runReaderT, ask, class MonadAsk)
import Effect (Effect)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Console (log)
---------------------------------------------------------