Skip to content

Instantly share code, notes, and snippets.

View tail-call's full-sized avatar
🐚
Conch in the Shell

Maria tail-call

🐚
Conch in the Shell
View GitHub Profile
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>
@tail-call
tail-call / serve-zip.py
Created July 15, 2020 02:19
Serve ZIP file contents as a local static website
#!/usr/bin/env python3
import time
from http.server import HTTPServer
from http.server import BaseHTTPRequestHandler
from zipfile import ZipFile
HOST_NAME = 'localhost'
PORT_NUMBER = 8000
source = ZipFile('files.zip', 'r')
@tail-call
tail-call / compress.js
Created July 12, 2020 16:04
Failed attempt at sequence compressor
function add(arr1, arr2) {
return arr1.map((x, i) => x + (arr2[i] || 0));
}
function mult(arr1, arr2) {
return arr1.map((x, i) => x * (arr2[i] || 0));
}
function sum(arr) {
return arr.reduce((acc, x) => acc + x);
@tail-call
tail-call / villagers.json
Last active May 12, 2024 12:04
Animal Crossing villagers, grabbed from nookipedia.com. I claim no copyright on this!
[
{
"name" : "Ace",
"gender" : "male",
"image" : "https://dodo.ac/np/images/thumb/4/4f/Ace_PG.png/30px-Ace_PG.png",
"species" : "bird",
"personality" : "jock"
},
{
"personality" : "cranky",
@tail-call
tail-call / theme.html
Created July 12, 2020 15:59
CSS variables theming demo that fits in a tweet
<style>body{--b:#0cf;--f:#fff}.d{--b:#009;--f:#ddd;background: gray}x{display:flex;justify-content:center;background:var(--b)}z{color:var(--f)}</style><x><z>wow demo<button onclick="(o=document.body).className=o.className?'':'d'">+