Instantly share code, notes, and snippets.

# Luke lukem512

Created May 11, 2023 08:22
Calculator for the dimensions of a brick or earthen pizza oven.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // Function to compute optimal dimensions for a pizza oven given a fixed door width and flue pipe area // For example, a door to accept a 12" pizza and an 8" flue pipe function pizzaOven(doorWidth, flueDiameter) { let doorHeight = flueDiameter / (doorWidth * 0.1); // flue is 10% the area of the door let domeWidth = doorWidth * 2; // door is ~50% the width of the dome let domeHeight = (doorWidth / 63) * 100; // door is ~63% the height of the dome return { dome: { width: domeWidth.toFixed(2),
Last active May 15, 2021 17:23
Calculator for yurt component dimensions and count. Specify a diameter and a wall height (or use the defaults) and you'll be shown how many poles, and of what lengths, are needed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 const defaults = { units: 'ft', // units to use, could be 'ft' or 'm' diameter: 14, // units wallHeight: 6, // units, at outer edge khanaHoleSpacing: 1, // units, spacing between crossing rods roofAngle: 25, // degrees from horizontal tonoDiameter: 1, // units } function deg2rad(deg) {
Created September 25, 2020 14:27
LukeCaster (a simple JavaScript raycaster)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 LukeCaster
Last active February 26, 2020 17:03
Simple chat UI demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 Chats
Created January 24, 2020 14:35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // Luke Mitchell & Max Peglar-Willis, 2020 // #include #include #include "queue.h" // Initialise a new queue of the // specified size
Created January 20, 2020 09:58
Colour Mixing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 Colour Swatch Mixing
Created January 7, 2020 15:50
Generate a random hexadecimal colour code in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // Function to generate a 24-bit (non-alpha) colour (color, for US English speakers) function makeRandomColour() { const MAX_INT24 = 16777215; return '#' + Math.round(Math.random() * MAX_INT24).toString(16); }
Created December 18, 2019 11:58
Colour Swatches Visualiser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 Colour Swatches
Created June 13, 2019 11:55
Mustache-based translations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 const fs = require('fs'); var exec = require('child_process').exec; const DATA = 'data/'; const TEMPLATES = 'templates/'; const OUTPUT = 'build/'; // Retrieve language from args const args = process.argv.slice(2); const lang = args[0];
Created December 20, 2017 23:19
Bitcoin difficulty target to compact bits conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 var MAX_PRECISION = 28; function _findExp (n, base, exp = 1) { var pow = Math.pow(base, exp); var div = Math.floor(n / pow); if (exp > MAX_PRECISION) { return div; } return div + _findExp(n, base, exp + 1); }