Skip to content

Instantly share code, notes, and snippets.

Potch potch

Block or report user

Report or block potch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
potch / procedure-fuzzer.js
Created Jan 3, 2020
procedure solver for Advent of Code 2019's Day 17
View procedure-fuzzer.js
let input = 'L,8,R,10,L,10,R,10,L,8,L,8,L,10,L,8,R,10,L,10,L,4,L,6,L,8,L,8,R,10,L,8,L,8,L,10,L,4,L,6,L,8,L,8,L,8,R,10,L,10,L,4,L,6,L,8,L,8,R,10,L,8,L,8,L,10,L,4,L,6,L,8,L,8,';
let out = [];
// convert every substr occurence in `arr` to a symbol in `str`
// toSymbols('12345123',['123','45']) yields 'ABA'
function toSymbols(str, arr) {
arr.forEach((s, i) => {
let re = new RegExp(s, 'g');
str = str.replace(re, String.fromCharCode(65 + i));
potch / tractorbeam.js
Created Dec 19, 2019
you really got a hold on me
View tractorbeam.js
const fs = require('fs');
const { IntCode, test } = require('../IntCode.js');
class Grid {
constructor({data, width, height}) {
if (data) { = data;
this.width = data[0].length;
this.height = data.length;
potch / findSubSequences.js
Last active Dec 17, 2019
Find the subsequences from Advent of Code 2019 Day 17 Part 2 by random sampling
View findSubSequences.js
let input = 'L,8,R,10,L,10,R,10,L,8,L,8,L,10,L,8,R,10,L,10,L,4,L,6,L,8,L,8,R,10,L,8,L,8,L,10,L,4,L,6,L,8,L,8,L,8,R,10,L,10,L,4,L,6,L,8,L,8,R,10,L,8,L,8,L,10,L,4,L,6,L,8,L,8,';
let out = [];
// convert every substr occurence in `arr` to a symbol in `str`
// toSymbols('12345123',['123','45']) yields 'ABA'
function toSymbols(str, arr) {
arr.forEach((s, i) => {
let re = new RegExp(s, 'g');
str = str.replace(re, String.fromCharCode(65 + i));
potch / spice-rack.js
Created Sep 4, 2019
laser turtles source file for spice racks
View spice-rack.js
UNIT = 'in';
// 100 units in an inch
SUBDIV = 100;
// material thickness
const U = 12.5;
// width of rack
const width = 1000;
// number of shelves
View blockquote.html
.post blockquote {
border-left: .5em solid #eee;
padding-left: 1.5em;
margin-left: 0;
View asyncawait.html
<p>Firefox 52 also includes a brand new JavaScript feature from ES2017: asynchronous functions and their companion, the <code>await</code> keyword. Async functions build on top of ES2015 Promises, allowing authors to write asynchronous sequences in a similar way to how they would write their synchronous equivalents.</p>
<p>Take the following example, which takes the result of one asynchronous request, modifies it, and passes it as the argument to a second asynchronous function. Here&#39;s how it would look with a traditional callback approach:</p>
<pre><code class="language-javascript">function doThings() {
doThingA(function (err, result) {
if (err) {
} else {
doThingB(result + 1, function (err, newResult) {
potch /
Last active Feb 22, 2017
Rendering Engines Post

The Road to Quantum Part 1: What are rendering engines?

If we’re going to start from somewhere, we should start from the beginning. A web browser is a piece of software that loads files (usually from a remote server) and displays them locally, allowing for user interaction.

Quantum is the codename for an project that we’ve undertaken at Mozilla to massively upgrade the part of Firefox that actually figures what do display to users based on those remote files[1]. The industry term for that part is “rendering engine”, and without one, you would just be reading code instead of actually seeing a website. Firefox’s rendering engine is called Gecko, and it’s been around for a pretty long while(replace this with how long).

It’s pretty easy for the most part to see the rendering engine as a single black box, sort of like a TV- data goes in, and the black box figures out what to display on the screen to represent that data. The question today is how? What are the steps to turning data into what users see?


potch / cool.js
Last active Feb 15, 2017
View cool.js
let index = ({title, name}) => `
${name ? `
<h2>Hello, ${name}.</h2>
<a href="#">Log in here</a>
potch / awaitIdle.js
Created Dec 15, 2016
Rather rough sketch of using requestIdleCallback to break up JS execution
View awaitIdle.js
function idle(action) {
return new Promise((resolve, reject) => {
requestIdleCallback(timing => resolve(action(timing)));
async function init() {
await idle(lessImportant);
await idle(nonCritical);
View genes.txt
You can’t perform that action at this time.