Skip to content

Instantly share code, notes, and snippets.

# WARNING: this code is kinda janky and i wouldn't suggest using it
# this decorator lets you write stuff like this:
# @versiononly(2)
# def foo():
# print('python 2 implementation of foo')
# @versiononly(3)
# def foo():
# print('python 3 implementation of foo')
(async function(){
function sleep(ms){return new Promise(function(resolve){setTimeout(resolve,ms);});}
const A = 'A'.charCodeAt(0);
const Z = 'Z'.charCodeAt(0);
let valid_suffixes = [];
for(let a = A; a <= Z; a++) {
for(let b = A; b <= Z; b++) {
let suffix = String.fromCharCode(a) + String.fromCharCode(b);
let url = `https://static-cdn.jtvnw.net/emoticons/v2/302662742_${suffix}/default/light/3.0`;
let response = await fetch(url)
# "Although the ROM provides a graphic for all 256 different possible 8-bit
# codes, some APIs will not print some code points, in particular the range
# 0-31 and the code at 127.[10] Instead, they will interpret them as control
# characters." (https://en.wikipedia.org/wiki/Code_page_437)
# the table from unicode mapped to the control characters, the table from ibm
# mapped to the graphics instead but wasn't in a format fontforge can import.
#
# GCGIDs from the ibm one converted using this for reference
# https://gist.github.com/SonOfLilit/2a144d525b32978fd3ae1adddd27d621
#
function createElementHelper(tagName, {style:{vars:styleVars={}, ...style}={}, attrs={}, events={}, classList=[], children=[], parent=null, insertBefore=null, ...props}={}) {
let elem = document.createElement(tagName);
for(let k in style) elem.style[k] = style[k];
for(let k in styleVars) elem.style.setProperty(k, styleVars[k]);
for(let k in attrs) elem.setAttribute(k, attrs[k]);
for(let k in events) elem.addEventListener(k, events[k]);
if(classList.length > 0) elem.classList.add.apply(elem.classList, classList);
for(let k in props) elem[k] = props[k];
for(let c of children) elem.appendChild(c);
if(parent !== null) {
@adrianmgg
adrianmgg / css.css
Created February 3, 2021 06:20
streamlabs shake animation (wip)
.widget-AlertBox {
position: relative;
}
body,
html {
height: 100%;
width: 100%;
overflow: hidden;
}
#wrap {
#include <iostream>
#define lazyPrint(x) std::cout << #x "=" << (x) << std::endl