Skip to content

Instantly share code, notes, and snippets.

<body>
<canvas id=canvas0></canvas>
<script> // local variables in all caps, globals lowercase
let x0 = 2, y0 = 5;
let redx = 2, redy = 7;
let blux = 2, bluy = 5;
let pts = {'2,5': 1, '2,6': 1, '2,7': 1};
let cursor = 1; // 0: off, 1: draw, 2: erase
let player = 1; // 1: red,
The quick brown fox jumped over the lazy dogs.
The quick brown fox jumped over the lazy dogs.
aaaa
this is a test of the emergency broadcast system.
help
me now
asdfljk
This is a cool demo
<html>
<head>
<style>
*{ font-family: sans-serif; }
label{ font-weight: bold; font-family: monospace; }
</style>
<script>
</script>
</head>
<body>
<html>
<head>
<style>
canvas{ position: relative; cursor: none;}
</style>
<script>
window.addEventListener("load", Init);
let focusx = 50, focusy = 50; // out of 100, ie a percent
let offsetx = 0, offsety = 0;
<html>
<head>
<style>
canvas{ position: relative; cursor: none;}
#span0{ display: none; }
body{ margin: 0; overflow: hidden; }
</style>
<script>
window.addEventListener("load", Init);
<html>
<head>
<style>
canvas{ position: relative; cursor: none;}
#span0{ display: none; }
body{ margin: 0; overflow: hidden; }
</style>
<script>
window.addEventListener("load", Init);
<!doctype html>
<html>
<head>
<style>
body{
margin: 0;
}
#main{
position: fixed;
top: 0;
<html>
<head>
<style>
</style>
</head>
<body>
<div id=title>
<h1> Polymorphic Data Programming With Javascript </h1>
<h3> By Derek McDaniel </h3>
</div>
@derekmc
derekmc / softlock.js
Last active September 4, 2023 16:19
Simple example of a "softlock" concurrent database
let softlock = require('softlock');
softlock.backoffAlgorithm('linear');
softlock.maxResets(4);
let query = softlock.query();
// Softlock is a concurrent database that emulates a locking mechanism using versioned keys.
// If a 'locked' key has been changed since the transaction started, then the transaction
// is rejected and the logic retried
query.lock(['a','b','c']); // these keys are locked, but their values are not retrieved.
<h1> Business Site Tutorial </h1>
<p> This document will describe how to create a business website.
</p>
<h1> Languages </h1>
<p> While language may not be the first choice you make, to get started writing the actual code, you must choose a language. The languages I recommend for standard web development are php, python, ruby or nodejs.
</p>