Skip to content

Instantly share code, notes, and snippets.

View DetachHead's full-sized avatar
💭
🟨🟨🟨

DetachHead

💭
🟨🟨🟨
View GitHub Profile
@DetachHead
DetachHead / index.ts
Last active March 1, 2023 12:59
compile-time a=b runtime written in typescript
// i made this to troll my friend
// https://store.steampowered.com/app/1720850/AB/
type Contains<T extends string, Substring extends string> = T extends `${string}${Substring}${string}` ? true : false
type ReplaceOne<T extends string, Find extends string, ReplaceWith extends string> =
T extends `${infer Start}${Find}${infer End}`
? `${Start}${ReplaceWith}${End}`
: T
# a python repl that actually exits on ctrl+C
while True:
try:
code = input(">>> ")
try:
print(eval(code))
except SyntaxError:
exec(code)
except KeyboardInterrupt:
exit(1)