This file contains 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
<div style="font-size: 32px; width: 200px; height: 200px; font-weight: bold; "> | |
I is black --> out is black | |
I is white --> out is white | |
I is gray --> out is gray?? | |
I << H --> I? | |
</div> |
This file contains 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 Pin<X extends Record<string, Record<string, keyof X>>> = { | |
[Obj in keyof X]: { | |
[F in keyof X[Obj]]: Pin<X>[X[Obj][F]] | |
} | |
}; | |
type Loopy = Pin<{ | |
one: { | |
a: "one", | |
b: "two", |
This file contains 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 re | |
class ParseResult: | |
""" | |
Represents the result of parsing an input. | |
`object` is the thing that was parsed from the beginning of the input. | |
`rest` is everything that follows the `object` within the input. | |
""" |
This file contains 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
// Splits `T` at the first occurrence of `S`. | |
type SplitBy<T extends string, S extends string> = | |
T extends `${infer A}${S}${infer B}` | |
? { before: A, split: S, after: B } | |
: never; | |
type SplitInfo = { before: string, split: string, after: string }; | |
type UseShorter<A extends SplitInfo, B extends SplitInfo> = | |
A["before"] extends `${B["before"]}${infer R}` ? B : A; |
This file contains 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
// >zig version | |
// 0.6.0 | |
// >zig test src/crash.zig | |
// Unreachable at D:\a\1\s\src\ir.cpp:28528 in buf_write_value_bytes. This is a bug in the Zig compiler. | |
// Unable to dump stack trace: debug info stripped | |
const S = struct {}; | |
test "Crashes" { |
This file contains 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
fn runtime(x: u32) bool { | |
return x % 2 != 0 and x % 3 != 0 and x % 5 != 0 and x % 7 != 0 and x % 11 != 0; | |
} | |
fn loopLegal(comptime arr: var) void { | |
inline for (arr) |e, i| { | |
while (true) { | |
if (!runtime(i)) { | |
break; | |
} |
This file contains 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
#include <stdio.h> | |
#include <windows.h> | |
#include <stdbool.h> | |
typedef struct docstring docstring; | |
typedef struct wdocument wdocument; | |
typedef struct wattribute wattribute; | |
struct wattribute { | |
docstring* name; |