Cardioid

Inspired by a YouTube video.

Squares

Just random colorful stuff.

C11 ADTs (sort of)

Haskell:

data T = A | B Int | C Int Int | D T

hello :: T -> Int
hello t =
    case t of
        A       -> 0
        B x     -> x
        C x y   -> x + y
        D t'    -> hello t'

C11:

struct T {
    enum {
        T_TAGA, T_TAGB, T_TAGC, T_TAGD
    } tag;

    union {
        struct {
        } A;

        struct {
            int p0;
        } B;

        struct {
            int p0;
            int p1;
        } C;

        struct {
            struct T* p0;
        } D;
    };
};

int hello(const struct T* t) {
    switch (t->tag) {
    case T_TAGA:
        return 0;
    case T_TAGB:
        return t->B.p0;
    case T_TAGC:
        return t->C.p0 + t->C.p1;
    case T_TAGD:
        return hello(t->D.p0);
    default:
        fputs("missing pattern\n", stderr);
        abort();
    }
}

WebGL LCD Screen Burn-In "Fixer"

Whether this actually works or not, I can’t say for sure. The burn-in on my laptop’s LCD did disappear, though.

Click for fullscreen!

Link. Source code.

Inspired by this video.

Web Workers + Mandelbrot

Click to zoom!

Source available here.