Skip to content

Instantly share code, notes, and snippets.

@derekmc
derekmc / htmlapp.sh
Last active October 9, 2020 18:19
Output a boilerplate/template for a basic htmlapp.
#!/usr/bin/env sh
cat << 'EOF'
<!doctype html>
<html>
<head>
<title> Demo HTML App </title>
<style>
* {
<!doctype html>
<html>
<head>
<title> Chess </title>
<style>
* {
font-family: sans-serif;
user-select: none;
}
@derekmc
derekmc / tagfuncs.js
Last active November 16, 2020 21:22
Simple templating library where each html tag or input type is a function.
const TagFuncs = (function(){
// lets you update specific tags.
const IDPRE = "tagID-";
const watched_tags = {};
const id_counter = 0;
const id_list = [];
const ids_by_tag = {}; //
const id_htmls = []; // cache generated html for watched tags.

Async Softlock

Async softlock is an asynchronous database interface for reliably rejecting outdated transactions

Example:

// this caches the values of those keys locally too.
// an meta lock object can be called with 'lock' again to submit that, or with 'get' to add additional retrieval keys.
function fooQuery(){

let query = db.lock("key1 key2 key3").get("key4 key5"); // lock: {success: false, failure: false, wait: async ()=>false, keyList: [''], valueList: [''], valueMap: {}, lockedRevisions:{}}

// AutoHtml Demo:
/* instead of jsx,
Autohtml.tags has a bunch of built in functions which follow the following pattern:
function tagName(attributes(optional), text, text, text...){
return html;
}
*/
@derekmc
derekmc / guess.html
Last active February 22, 2021 18:45
<html>
<head>
<script src="./src/jszip.min.js"></script>
<script src="./src/FileSaver.min.js"></script>
<script>
// goto targets are capitalized
// contemporary programming make the mistake of being easy to debug, not easy to write.
// debugging is always hard, deal with it.
//
// So linguistic "decoupling" is more important, and easier, than "runtime" decoupling,
@derekmc
derekmc / war.html
Last active February 26, 2021 18:30
<html>
<head>
<script src="./src/jszip.min.js"></script>
<script src="./src/FileSaver.min.js"></script>
<script>
// goto targets are capitalized
// contemporary programming make the mistake of being easy to debug, not easy to write.
// debugging is always hard, deal with it.
//
// So linguistic "decoupling" is more important, and easier, than "runtime" decoupling,

The one equation to understand MMT Inflation

Total Valuation = Total Savings = Unit Value * Saved Units

The truth is, you don’t have to understand how prices work, you don’t have understand sectoral balances you don’t have to understand foreign trade and all that.

All those things can be worked out if you start from the right starting point. That is the following question:

const CSVFOLDER = "csv";
const LOGFOLDER = "log";
const LOGEXTENSION = ".csvlog";
const DEFAULTDB = "csvdb";
if(require.main === module){
Test();
<canvas id=Canvas></canvas>
<script>
let text = "> Hello,\n World.";
let Margin = 10;
let LineHeight = 14;
function Draw(){
let ctx = Canvas.getContext("2d");
ctx.font = "13px monospace"
ctx.fillStyle = "#dedede";
ctx.fillRect(0, 0, Canvas.width, Canvas.height);