Skip to content

Instantly share code, notes, and snippets.

View tail-call's full-sized avatar
🐚
Conch

Maria tail-call

🐚
Conch
View GitHub Profile
{
"magic": [0x2, 0x24, 0x99],
"version": { "!format": "u1", "!equal": { "!or": [0x14, 0x13] } },
}

Either for TypeScript

Is this working? I don't know.

//@ts-check
class PushbackIterator {
/**
* @param {Iterator<string, string, string>} stringIter
*/
constructor(stringIter) {
/** @type {Iterator<string, string, string>} */
this.stringIter = stringIter;
/** @type {Array<string>} */
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sections demo</title>
<style>
section {
display: none;
}
const phrases = [
["Champ,","the mere idea of you","has serious game,","24/7."],
["Fact:","your soul","rains magic,","can I get an amen?"],
["Everybody says","your hair today","deserves the Nobel Prize,","and that's a fact."],
["Dang…","everything you do","raises the roof,","so treat yourself."],
["Check it:","your personal style","breeds miracles,","you feel me?"],
["Just saying...","every thought you have","is paying off big time,","that's just science."],
["Superstar,","that sparkle in your eye","shows mad skills,","would I lie?"],
["Tiger,","your presence here","just shimmers,","for reals."],
["Self,","what you got going on","is a national treasure,","mic drop."],
@tail-call
tail-call / compress.ts
Created July 16, 2021 08:35
Compress JS strings for fun and profit
const maxCharCode = 2 ** 16 - 1;
export function compress(input: string): string {
let output = "";
for (let pos = 0; pos < input.length; pos++) {
const maxLookBack = Math.min(pos, maxCharCode);
let didOutputMatch = false;
let charsToSkip = 0;
for (let back = 0; back < maxLookBack; back++) {
let backLen = 0;
@tail-call
tail-call / JSONWrapper.swift
Last active June 19, 2023 15:03
I want to encode/decode [String: Any] that badly...
//
// JSONWrapper.swift
//
// Created by Maria Zaitseva on 16.03.2021.
//
import Foundation
/// This class provides a straightforward way to encode/decode
/// objects of type `[String: Any]` to and from JSON.
@tail-call
tail-call / jbol.txt
Created February 10, 2021 01:08
Designing a programming language that looks old...
ALGORITHM SHOW MESSAGE
PARAMETERS T$
VARIABLES D<>; M<>
START
10 IF T$ .EQ NULL THEN GOTO 70
20 PARAMETERS T$
30 CALL "createElement" OF DOCUMENT INTO D<>
40 SET "innerHTML" OF D<> TO T$
50 PARAMETERS "#messageArea"
60 CALL "querySelector" OF DOCUMENT INTO M<>
@tail-call
tail-call / base64Alphabet.js
Last active August 24, 2020 09:31
Get base64 alphabet
export const base64Alphabet = new Array(64).fill(null).map((_, i) => btoa(String.fromCharCode(0, 0, i))[3]).join('');
data:text/html,<script>d=document,d.querySelector('*').append(d.createTextNode(location))</script>
Shorter, non-HTML5:
data:text/html,<script>d=document,d.all[0].append(d.createTextNode(location))</script>