This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HOW TO MAKE ASCII ART (TWITCH EDITION) | |
| ================================================================ | |
| 1. Save the image you want to transform into ASCII | |
| 2. Go to https://lachlanarthur.github.io/Braille-ASCII-Art/ | |
| 3. Set width to 24 characters and Invert on | |
| 4. Copy the result | |
| 5. Replace newlines by spaces | |
| ================================================================ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let ( let*? ) = Option.bind | |
| let ( let|? ) opt fn = | |
| match opt with | |
| | None -> fn () | |
| | Some value -> opt | |
| let ( let@ ) = ( @@ ) | |
| let array_of_string s = Array.of_seq (String.to_seq s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* boilerplate *) | |
| module type T = sig | |
| type t | |
| end | |
| module type INT = module type of Int | |
| (* the goofy type *) | |
| type 'a t = What of < value : 'a; ty : 'c > constraint 'c = (module T with type t = 'a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ruff: noqa: D100, D103, A001, A002 | |
| from __future__ import annotations | |
| from typing import TYPE_CHECKING | |
| if TYPE_CHECKING: | |
| from collections.abc import Callable | |
| type List[T] = tuple[()] | tuple[T, List[T]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* SGR stack machine *) | |
| module Color = struct | |
| type t = | |
| | Basic of int | |
| | Rgb of int * int * int | |
| end | |
| module Style = struct | |
| type t = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| A | |
| ABC | |
| ABCMeta | |
| ACCESS_COPY | |
| ACCESS_DEFAULT | |
| ACCESS_READ | |
| ACCESS_WRITE | |
| ACK | |
| ACTIVE | |
| ADDITEMS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type nil = Nil | |
| (* This version is unsafe because it makes the assumption that index >= 0. *) | |
| let rec get_unsafe : 'a. at:int -> from:'a list -> 'a | nil = | |
| fun ~at:index ~from:list -> | |
| match list with | |
| | [] -> Nil | |
| | first :: _ when index = 0 -> first | |
| | _ :: rest -> get_unsafe ~at:(index - 1) ~from:rest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* -*- Interfaces -*- *) | |
| module type ORDERED = sig | |
| type ('a, 'b) t | |
| end | |
| module type LINEAR = sig | |
| include ORDERED | |
| val exchange : 'a 'b. ('a, 'b) t -> ('b, 'a) t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import enum | |
| import typing | |
| class Nat(enum.Enum): | |
| O = enum.auto() | |
| S = enum.auto() | |
| type nat = typing.Literal[Nat.O] | tuple[typing.Literal[Nat.S], nat] | |
| O = Nat.O |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Util = struct | |
| let ( let*? ) = Option.bind | |
| let ( let*! ) = Result.bind | |
| let ( let@ ) = ( @@ ) | |
| let ( *> ) f g x = g (f x) | |
| let curry = ( @@ ) | |
| let curry2 f a b = f (a, b) | |
| let curry3 f a b c = f (a, b, c) | |
| let ( let|> ) a k = a (curry k) | |
| let ( let||> ) a k = a (curry2 k) |
NewerOlder