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 sourceUrl = "https://m3u8-0.c-spanvideo.org/clip/clip.5081597.576.tsc.m3u8" | |
const source = await fetch(sourceUrl) | |
.then(res => res.ok ? res.text() : undefined) | |
if (!source) | |
throw new Error("it's over") | |
const tsBlobs = await Promise.all( | |
source | |
.split("\n") |
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 * primes(max = 1_000) { | |
const isComposite = [] | |
for (let i = 2; i <= max; i++) if (!isComposite[i]) { | |
yield i | |
for (let j = i**2; j <= max; j += i) | |
isComposite[j] = true | |
} | |
} |
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 { pipe } = await import("https://unpkg.com/[email protected]/src/util/index.mjs") | |
const { listen, map, filter, forEach, tap } = await import("https://unpkg.com/[email protected]/src/util/iterable/async.mjs") | |
const makePuzzle = (n = 4) => { | |
const solvedPuzzle = | |
[...Array(n)] | |
.map((_, rowI) => | |
[...Array(n)].map((_, colI) => rowI * n + colI + 1) | |
) | |
solvedPuzzle[n - 1][n - 1] = 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
MIT License | |
Copyright (c) 2021 Daniel Ethridge | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
data:audio/ogg;base64,T2dnUwACAAAAAAAAAADFVwH2AAAAAPid/iQBE09wdXNIZWFkAQE4AYC7AAAAAABPZ2dTAAAAAAAAAAAAAMVXAfYBAAAA+2xiXQE+T3B1c1RhZ3MNAAAATGF2ZjU4LjQ1LjEwMAEAAAAdAAAAZW5jb2Rlcj1MYXZjNTguOTEuMTAwIGxpYm9wdXNPZ2dTAACAuwAAAAAAAMVXAfYCAAAAF6YmxTIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDSTs9TkxBSUBERElGQkRCP0JBQDtBQEEsLPj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//vj//ngL5QtGqtuEn/os6qNWLtN0+6mJ+QtRNy+8k7Z+K3ClKyD+yOXUrsFdj5v//gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4grU3ETE+ivMH/IxJJjrIWQAneFkU+65/K35PEGNsMJnSh2RNy8xdRCyaF41RV1fWbrD+S+t9bU7vH3iDABIwT5oh6a8xpe8251fEFv77OI2QsbO0vQtyZc1dd30i5EZr647kYhWq5HRbdixE3Dw0NQreisfyVW14q9ZBY4yC10V4l9XohOlCB5PABWmj0Yu59X9DZsYwEl2RdckXrr9apKtQxOUbS3fnTVqZozZa7+JrG1bgJIQ5B0BR16L6pAPpVTRASyt4sfvolrRCgMCnpIU/QoJ3U2qlPis6eNQr47r4kklWKLGEsMLnDqWu06Jgw18XImW+ODORJX332FiNNqiZdK7OEHiiDwKrh0YJC06XeLPJYYlIztj3WR4Nq+1Nafr6eY8MxPmOvYtU9y0shFOvBR0yn9JgimfAC9uO8bJk9DLZ3/v97XyMu244mLy/apd4tEuPmc4oNAQu1GgHptAr6yP8GM6Vc7hI1/nKb0gTterk0lssjrcHvXuAzsBlQBCBt3 |
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 https = require("https") | |
const pageHTMLHandler = html => { | |
const videoURL = html.match(/https:\/\/vidstreaming\.io\/load\.php\?id=.*?SUB/)[0] | |
require("child_process").exec(`open "${videoURL}"`) | |
} | |
const requestHandler = HTMLHandler => response => { | |
let html = "" | |
response.on("data", chunk => html += chunk) |
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 data = [...document.querySelectorAll("#scoreTable > tbody tr")] | |
.filter(a => a.cells.length > 1) | |
.map(a => { | |
const score = a.cells[10].innerText | |
const [earned, possible] = score.split("/").map(n => parseFloat(n)) | |
return { | |
category: a.cells[1].innerText, | |
earned, possible | |
} | |
}) |
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
window.jsConsoleState = { | |
lines: ["This is a JavaScript console.\nTo clear history, run clear()\nTo exit, run exit()"], | |
isLooping: true | |
} | |
const jsConsole = () => { | |
// Show the previous lines above the prompt | |
const input = prompt(window.jsConsoleState.lines.join("\n")) | |
// Push user input for next prompt | |
window.jsConsoleState.lines.push(input) |
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
{ | |
"politics": [ | |
{ | |
"title": "Heligoland–Zanzibar Treaty\n", | |
"image": "https://histography.io/images/2562.jpg", | |
"link": "https://en.wikipedia.org/wiki/Heligoland–Zanzibar_Treaty" | |
}, | |
{ | |
"title": "Treaty of Madrid \n", | |
"image": "https://histography.io/images/2563.jpeg", |
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 Task = run => ({ | |
// (a -> e) -> (a -> r) -> Task(a) // Might be inaccurate idk | |
run, | |
// undefined -> undefined | |
log: () => | |
run(console.error) | |
(console.log), | |
// (a -> b) -> Task(b) |
NewerOlder