Public
Edited
Jul 26, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rawNotes = fetch(notesUrl)
.then((r) => r.blob())
.then((b) => b.text())
Insert cell
lines = rawNotes
.split("\n")
// strip empty lines
.filter((x) => x)
Insert cell
function chunkifyNote(note) {
if (note.includes("/")) {
const [same, time] = note.split("/");

return [...chunkifyNote(same), "/", ...chunkifyNote(time)];
}

if (note.includes("<")) {
const [first, second] = note.split("<");

return [first, "<", second];
}

if (note.includes(">") && !note.includes("->")) {
const [first, second] = note.split(">");

return [first, ">", second];
}

if (_.startsWith(note, "!!!")) {
return ["!!!", _.drop(note, 3).join("")];
}

if (_.startsWith(note, "!!")) {
return ["!!", _.drop(note, 2).join("")];
}

if (_.startsWith(note, "!")) {
return ["!", _.drop(note, 1).join("")];
}

return [note];
}
Insert cell
function chunkifyLine(line) {
return line.split(" ").map(chunkifyNote).flat();
}
Insert cell
chunkifiedLines = lines.map(chunkifyLine)
Insert cell
ABBREVIATIONS = ({
"->": "into",
"/": "over",
"!": "caution",
"!!": "double caution",
"!!!": "double caution",
">": "tightens into",
"<": "widens into",
l: "left",
r: "right",
keepr: "keepright",
keepl: "keepleft",
hlong: "halflong",
jmp: "jump",
"jmp?": "maybe jump",
cr: "crest",
l1: "left 1",
l2: "left 2",
l3: "left 3",
l4: "left 4",
l5: "left 5",
l6: "left 6",
r1: "right 1",
r2: "right 2",
r3: "right 3",
r4: "right 4",
r5: "right 5",
r6: "right 6",
sqL: "square left",
sqR: "square right",
HPl: "hairpin left",
HPr: "hairpin right",
"open-HPr": "open hairpin left",
"open-HPl": "open hairpin right",
samir: "you're breaking the car"
})
Insert cell
function describeChunk(note) {
return ABBREVIATIONS[note] || note;
}
Insert cell
describedLines = chunkifiedLines.map((chunks) => chunks.map(describeChunk))
Insert cell
chunkifiedLine = chunkifiedLines[line]
Insert cell
describedLine = describedLines[line]
Insert cell
chunkifiedRow = chunkifiedLine.map((chunk) => html`<td>${chunk}</td>`)
Insert cell
describedRow = describedLine.map((chunk) => html`<td><b>${chunk}</b></td>`)
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more