Skip to content

Instantly share code, notes, and snippets.

Avatar
🏳️‍🌈

Anton Istomin tail-call

🏳️‍🌈
View GitHub Profile
@tail-call
tail-call / JSONWrapper.swift
Created Mar 16, 2021
I want to encode/decode [String: Any] that badly...
View JSONWrapper.swift
//
// JSONWrapper.swift
//
// Created by Anton Istomin 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 Feb 10, 2021
Designing a programming language that looks old...
View jbol.txt
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 Aug 24, 2020
Get base64 alphabet
View base64Alphabet.js
export const base64Alphabet = new Array(64).fill(null).map((_, i) => btoa(String.fromCharCode(0, 0, i))[3]).join('');
View ContentView.swift
//
// ContentView.swift
// swui
//
// Created by Tcheshuyka on 28.07.20.
// Copyright © 2020 Tcheshuyka LLC. All rights reserved.
//
import SwiftUI
struct ContentView: View {
View gist:9360d5f851d13abc7aabd08b08f4e44e
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 Jul 15, 2020
Serve ZIP file contents as a local static website
View serve-zip.py
#!/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 Jul 12, 2020
Failed attempt at sequence compressor
View compress.js
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);
View animal-crossing-villagers.json
[
{
"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 Jul 12, 2020
CSS variables theming demo that fits in a tweet
View theme.html
<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'">+
@tail-call
tail-call / prime.js
Created Jul 12, 2020
I wanted a very big sequence of primes but why
View prime.js
const seq1 = [2, 3];
const seq2 = [2, 3, 5];
const seq3 = [5, 7, 11, 13, 17];
const seq4 = [7, 11, 13, 17, 19, 23, 29];
const length = seq1.length * seq2.length * seq3.length * seq4.length;
const p = (seq, i) => seq[i % seq.length];
for (let i = 0; i < length; i++) {