Skip to content

Instantly share code, notes, and snippets.

View joehonton's full-sized avatar
💭
Writing clean code one line at a time

Joe Honton joehonton

💭
Writing clean code one line at a time
View GitHub Profile
function computeLayout(idleDeadline) {
var milliseconds = idleDeadline.timeRemaining();
var haltTime = performance.now() + milliseconds;
for (let i=lastIndex; i < queue.length; i++) {
if (performance.now() > haltTime)
break;
// pseudocode
x = R cosΦ sin(λ - λ₀)
// A large array of points awaiting projection
var queue = [];
// index into the array of the next item to compute
var lastIndex = 0;
var idleCallbackId = 0;
. . .
@joehonton
joehonton / 2021-046-variations-on-the-html-two-step.blue
Last active July 6, 2021 22:44
BluePhrase: Variations on the HTML Two-Step
!blue 2.0
h2.kicker Programmer Productivity
h1 Variations on the HTML Two-Step
figure {
img `https://javascriptfanboi.com/img/046/modern-dancers.jpg` *alt='Fancy footwork of modern dancers'
figcaption Photo by Haste LeArt V. from Pexels
}
@joehonton
joehonton / 2021-046-variations-on-the-html-two-step.wikitext
Last active July 6, 2021 22:49
Wikitext: Variations on the HTML Two-Step

    1. Programmer Productivity ##
  1. Variations on the HTML Two-Step #
<figure> <img src="https://javascriptfanboi.com/img/046/modern-dancers.jpg"></img> &lt;figcaption&gt;Photo by Haste LeArt V. from Pexels&lt;/figcaption&gt; </figure> The World Wide Web's hypertext markup language (HTML) has an inherent beauty all its own:

@joehonton
joehonton / 2021-046-variations-on-the-html-two-step.html
Last active July 6, 2021 22:48
HTML: Variations on the HTML Two-Step
<h2 class=kicker>Programmer Productivity</h2>
<h1>Variations on the HTML Two-Step</h1>
<figure>
<img src='https://javascriptfanboi.com/img/046/modern-dancers.jpg' alt='Fancy footwork of modern dancers' />
<figcaption>Photo by Haste LeArt V. from Pexels</figcaption>
</figure>
<p>The World Wide Web's hypertext markup language (HTML) has an inherent beauty all its own:</p>
<ul>
<li>Both the author's words and the typographer's instructions are contained in a single plain text file.</li>
<li>Instructions are encoded using short, easily remembered mnemonics.</li>
@joehonton
joehonton / 2021-046-variations-on-the-html-two-step.md
Last active July 6, 2021 22:47
Markdown: Variations on the HTML Two-Step

Programmer Productivity

Variations on the HTML Two-Step

Fancy
	footwork of modern dancers

Photo by Haste LeArt V. from Pexels
function isInsideClippedPolygon(polygon, mouseX, mouseY) {
let c = false;
// make sure there are at least 3 visible nodes
var countv = 0;
for (let k=0; k < polygon.length && countv < 3; k++) {
if (polygon[k].visible == true)
countv++;
}
if (countv < 3)
const shapes = new Map();
shapes.set('triangle',
[{x:100, y:100},
{x:120, y:120},
{x:140, y:140},
{x:100, y:100}]);
shapes.set('quadrangle',
[{x:371, y:229},
{x:229, y:229},
{x:229, y:371},
function isInsidePolygon(polygon, mouseX, mouseY) {
const c = false;
for (let i=1, j=0; i < polygon.length; i++, j++) {
const ix = polygon[i].x;
const iy = polygon[i].y;
const jx = polygon[j].x;
const jy = polygon[j].y;
const iySide = (iy > mouseY);
const jySide = (jy > mouseY);
const articleUrls = [
'/feb-28-2021.html',
'/feb-21-2021.html',
'/feb-14-2021.html',
'/feb-07-2021.html'
];
const nextIndex = 0;
async fetchNextArticle() {
// fetch the article using HTTP