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
// "1.2" -> 1.2 | |
console.assert(convert('1.2') === 1.2) | |
// " " -> " " (not a number) | |
console.assert(isNaN(convert(' '))) | |
console.assert(isNaN(convert(''))) | |
// "12a" -> "12a" (not a number) | |
console.assert(convert('12a') === '12a') | |
console.assert(isNaN(convert('12a'))) | |
// null -> null (not a number) | |
console.assert(convert(null) === null) |
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
'use strict' | |
const { exec } = require('child_process') | |
const assert = require('assert') | |
const fs = require('fs') | |
const path = require('path') | |
const util = require('util') | |
const { minify } = require('terser') | |
const readFile = util.promisify(fs.readFile) |
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 assert = require('assert') | |
// I'm trusting R's built in helper for calculating expected values | |
// https://repl.it/repls/IroncladLightpinkBookmark | |
const samples = [ | |
{ | |
input: [187], | |
expected: 187, | |
}, | |
{ |
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
{ | |
"background_color": "#fff", | |
"description": "Web dev job gone south.", | |
"display": "fullscreen", | |
"icons": [ | |
{ | |
"purpose": "maskable", | |
"sizes": "192x192", | |
"src": "icon.png", | |
"type": "image/png" |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="description" content="Select all to reveal page content"> | |
<title>Select all</title> | |
<style> | |
html { | |
color: white; | |
display: flex; |
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 assert = require('assert'); | |
// Produce random (signed) integers from min inclusive to max exclusive | |
function randint(min = 0, max) { | |
let lo = min; | |
let hi = max; | |
if (typeof max === 'undefined') { | |
hi = lo; | |
lo = 0; |
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
#!/usr/bin/env node --use-strict | |
const path = require('path') | |
const { exec, execSync } = require('child_process') | |
const { readdir } = require('fs') | |
const bento4 = require('bento4-installer') | |
const assets = path.join(__dirname, './assets') | |
readdir(assets, async (error, filesMaybe) => { |
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
// Adapted from, | |
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadedmetadata_event | |
async function getBlobDuration(blob) { | |
const buffer = document.createElement('video') | |
const result = new Promise((resolve, reject) => { | |
buffer.onerror = reject | |
buffer.onloadedmetadata = () => { | |
resolve(buffer.duration) | |
} | |
}) |
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
#!/bin/sh | |
# Helps produce iconsets | |
# Usage: | |
# ./gicns input.png output.icns | |
# Reference: | |
# http://stackoverflow.com/questions/12306223/how-to-manually-create-icns-files-using-iconutil | |
# Shortcut |
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
#!/bin/sh | |
# Helps turn videos into gif strips | |
# Usage: | |
# ./gfilm input.mp4 output.gif | |
# Reference: | |
# https://imagemagick.org/script/montage.php | |
# Shortcut |