Skip to content

Instantly share code, notes, and snippets.

from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Awaitable, Generic, Generator, Iterable, \
List, Tuple, TypeVar, cast
###
T = TypeVar('T')
R = TypeVar('R')
@Garciat
Garciat / flooring.html
Last active February 1, 2025 00:16
Flooring // A random pattern that I once saw at an airport. Click to randomize.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Flooring</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html, body {
height: 100%;
margin: 0;
@Garciat
Garciat / mandala.html
Last active January 31, 2025 23:07
Mandala Creator // This is how drawmandala.app started. I programmed this on my tablet, of all places.
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Mandala</title>
<style type="text/css">
html, body {
overflow: hidden;
width: 100%;
{-# Language ConstraintKinds #-}
{-# Language DataKinds #-}
{-# Language FlexibleInstances #-}
{-# Language KindSignatures #-}
{-# Language MultiParamTypeClasses #-}
{-# Language PolyKinds #-}
{-# Language RankNTypes #-}
{-# Language ScopedTypeVariables #-}
{-# Language TypeOperators #-}
module Schema where
@Garciat
Garciat / Vect.hs
Last active November 12, 2018 12:17
{-# Language DataKinds #-}
{-# Language GADTs #-}
{-# Language KindSignatures #-}
{-# Language NoImplicitPrelude #-}
{-# Language StandaloneDeriving #-}
{-# Language TypeFamilies #-}
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
module Vect where
module StackExpr where
data Instr
= Const Integer
| Add
| Sub
| Mul
| Neg
| Abs
| Sig
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.function.*;
// Scott encoding of a Haskell's Maybe
interface Maybe<T> {
<R> R match(Supplier<R> nothing, Function<T, R> just);
@Garciat
Garciat / screenshot-1x1.png
Last active January 31, 2025 23:12
Wall Tiles // Simulates lighting on some tiles. The light math is completely off, but I tried.
screenshot-1x1.png
@Garciat
Garciat / videogram.html
Last active January 30, 2025 11:02
[hide] Videogram // Renders a video on a canvas, masked by random circles controlled by the mouse.
<!DOCTYPE html>
<html>
<head>
<title>Videogram</title>
<style>html,body{margin:0;height:100%;}</style>
</head>
<body>
<video src="https://dl11.webmfiles.org/big-buck-bunny_trailer.webm" style="display:none" autoplay loop></video>
<script defer>
import Data.Maybe (catMaybes)
import qualified Data.Set as Set
(|>) = flip ($)
between :: Ord a => a -> (a, a) -> Bool
between x (a, b) = a <= x && x <= b
class Clamp a where
clampedBy :: a -> (a, a) -> a