Skip to content

Instantly share code, notes, and snippets.

View JanDW's full-sized avatar
🕳️

Jan De Wilde JanDW

🕳️
View GitHub Profile
@JanDW
JanDW / bass.md
Created March 18, 2019 17:55
Double bass—fingerboard octave

Bass fingerboard octave

E A D G position
F A♯/B♭ D♯/E♭ G♯/A♭ ½
F♯/G♭ B E A 1
G C F A♯/B♭ 2
G♯/A♭ C♯/D♭ F♯/G♭ B
A D G C 3
@JanDW
JanDW / optPoolSize.py
Created August 10, 2020 00:54
The mathematics of COVID-19 pool testing
# -*- coding: utf-8 -*-
"""
Estimates the optimal pandemic testing pool size
Ref: https://asm.org/Articles/2020/July/COVID-19-Pool-Testing-Is-It-Time-to-Jump-In
https://www.statnews.com/2020/06/26/pool-testing-covid-19/
Created on Sun Aug 2 20:29:23 2020
@author: johnx
"""
@JanDW
JanDW / .eleventy.config.js
Created August 15, 2020 18:23 — forked from danielpost/.eleventy.config.js
Eleventy: Purge CSS for each html file
const { PurgeCSS } = require('purgecss');
/**
* Remove any CSS not used on the page and inline the remaining CSS in the
* <head>.
*
* @see {@link https://github.com/FullHuman/purgecss}
*/
eleventyConfig.addTransform('purge-and-inline-css', async (content, outputPath) => {
if (process.env.ELEVENTY_ENV !== 'production' || !outputPath.endsWith('.html')) {
@JanDW
JanDW / boonieSim.m
Created August 31, 2020 01:23
Simulates the Boonie Conundrum
% Simulates the Boonie Conundrum
%
%
% Input(s)
% DispOn: Displays the graph of student and teacher rumor knowledge
% Modify simulation parameters in the code below
%
% Output(s)
% studentFraction: Fraction of student population that knows the rumor
% teacherFraction: Fraction of teacher population that knows the rumor
@JanDW
JanDW / boonie_Monte_Carlo.m
Created August 31, 2020 01:59
Runs a Monte Carlo experiment of the Boonie simulation
% Runs a Monte Carlo experiment of the Boonie simulation
%
%
% Input(s)
% nMC: Number of Monte Carlo iterations
%
% Output(s)
% Days: Vector of days until Boonie gets caught
%
% Example:
function shuffleArray(arr) {
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]];
}
}
const montyHall = (n) => {
let wins = 0;
let doors = ["goat", "goat", "car"];
@JanDW
JanDW / outliner-snippet.js
Last active September 23, 2022 13:47
Applies outline and background-color in order to more readily understand layouts.
if (!document.querySelector("#debugStyles")) {
const style = document.createElement("style");
style.setAttribute("id", "debugStyles");
style.innerHTML = `
.debug-boxes * {
outline: 1px solid blue;
background-color: rgba(0,255,255,.05);
}
`;
document.head.appendChild(style);
@JanDW
JanDW / Untitled-1
Created September 22, 2022 18:34
Section instance consistently fails to render in page editor
instrument.ts:129 TypeError: Cannot read properties of undefined (reading 'label')
at Select.tsx:28:73
at Ru (react-dom.production.min.js:262:359)
at t.unstable_runWithPriority (scheduler.production.min.js:18:343)
at Wo (react-dom.production.min.js:122:325)
at Au (react-dom.production.min.js:261:308)
at gu (react-dom.production.min.js:243:50)
at react-dom.production.min.js:123:115
at t.unstable_runWithPriority (scheduler.production.min.js:18:343)
at Wo (react-dom.production.min.js:122:325)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Container Queries Javascript</title>
<body>
<main>
<style>
*,
@JanDW
JanDW / aspect-ratio-layout-2.html
Created November 10, 2023 02:32
Using parent CSS selector (:has()) to target the desired layout
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Container Queries Javascript II</title>
<body>
<main>
<style>