Skip to content

Instantly share code, notes, and snippets.

const D: &str = r#"
a polyglot quine in rust and HTML
<svg onload="b=document.body;d=b.innerHTML.replace(/a(m)p;/g,[]);b.innerHTML='<pre id=q>';q.innerText=d.slice(![],(_=-~-~-~[],-_*(_+_+!![])))">
<path d="M34,35L59,10L10,102L110,32L109,97L105,110L40,41L32,123L10,32L32,32L32,112L114,105L110,116L108,110L33,40L10,32L32,32L32,32L32,32L32,34
L99,111L110,115L116,32L95,58L32,38L115,116L114,32L61,32L114,35L92,34L123,125L123,125L34,44L32,68L44,32L68,46L99,104L97,114L115,40
L41,46L102,111L108,100L40,40L86,101L99,58L58,60L99,104L97,114L62,58L58,110L101,119L40,41L44,32L83,116L114,105L110,103L58,58L110,101
L119,40L41,41L44,32L124,40L109,117L116,32L114,101L115,117L108,116L44,32L109,117L116,32L99,117L114,114L101,110L116,41L44,32L99,124
L32,123L10,32L32,32L32,32L32,32L32,32L32,32L32,105L102,32L99,46L105,115L95,100L105,103L105,116L40,49L48,41L32,123L32,99L117,114
L114,101L110,116L46,112L117,115L104,40L99,41L59,32L125,10L32,
const str = [...`stegosaurus`]
.map((d) => String.fromCodePoint(0xe0000 + d.charCodeAt()))
.join('');
document.body.innerHTML = `unescape(escape\`${str}\`.replace(/u.{8}/g,""))`;
@kirjavascript
kirjavascript / stackblitz-vim.js
Last active November 16, 2022 19:56
stackblitz-vim
(()=>{var Vr=Object.defineProperty;var Fr=(w,s,h)=>s in w?Vr(w,s,{enumerable:!0,configurable:!0,writable:!0,value:h}):w[s]=h;var J=(w,s,h)=>(Fr(w,typeof s!="symbol"?s+"":s,h),h);var{KeyCode:ve,Range:xe,Position:Fe,Selection:nt,SelectionDirection:it}=monaco,Ve=window.monaco.editor,Wr={Bottom:4},Ur={readOnly:65,cursorWidth:20,fontInfo:32},$r=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function jr(w){return/\w/.test(w)||w>"\x80"&&(w.toUpperCase()!=w.toLowerCase()||$r.test(w))}function We(w,s){if(!(this instanceof We))return new We(w,s);this.line=w,this.ch=s}function Jr(w,s,h){w.dispatch(s,h)}function Re(w){return function(){}}var Wt,Ut;String.prototype.normalize?(Wt=function(w){return w.normalize("NFD").toLowerCase()},Ut=function(w){return w.normalize("NFD")}):(Wt=function(w){return w.toLowerCase()},Ut=function(w){return w});var jt=function(w,s){this.pos=this.start=0,this.string=w,this.tabSize=s||8,this.lastColumnPos=this.lastColumnValue=0,this.line
@kirjavascript
kirjavascript / qube.js
Created November 1, 2022 18:54
weird rubik sim
S = `
UUU
UUU
UUU
LLLFFFRRRBBB
LLLFFFRRRBBB
LLLFFFRRRBBB
DDD
DDD
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Spring</title>
</head>
<div id="s" style="font-size:3em">#</div>
<body>
<script>
rectBuffer := generalCounter
rectX := rectBuffer+0
rectY := rectBuffer+1
rectW := rectBuffer+2
rectH := rectBuffer+3
rectAttr := rectBuffer+4
rectAddr := rectBuffer+5 ; positionValidTmp
@kirjavascript
kirjavascript / h2.js
Last active September 21, 2020 22:13
let c = Symbol();
h = (tag, attrs = {}, children = [], node = document.createElement(tag)) => {
node[c] = children;
Object.entries(attrs).map(([k, v]) =>
/^on/.test(k)
? node.addEventListener(k.slice(2), v)
: node.setAttribute(k, v),
);
return node;
};
const whitespaceSymbol = Symbol('whitespace');
const whitespace = rawWhitespace.map(() => whitespaceSymbol);
const param = (param) => composeParsers([param, whitespace]);
// const
const sexpr = (fn) => {
const [head, ...tail] = fn();
const params = sequenceOf([head, ...tail.map(param)]);
@kirjavascript
kirjavascript / index.html
Last active September 16, 2020 11:39
MutString
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</title>
</head>
<body>
<script>
r=(fn) => {
try {
return fn();
} catch (e) {
// if (e instanceof ReferenceError) {
if (/^Re/.test(e+[])) {
globalThis[q=e.message.split` `[0]]=q;
return r(fn)
} else {
throw e;