All TODOs from public vals

Screenshot 2024-02-26 at 10.19.04 AM.png

Todo

  • Remove forks from results ?
  • use a cron val to cache results in an sqlite table
Readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import codeOnValTown from "https://esm.town/v/andreterron/codeOnValTown?v=46";
import { api } from "https://esm.town/v/pomdtr/api";
import { gfm } from "https://esm.town/v/pomdtr/gfm";
import { html } from "https://esm.town/v/stevekrouse/html?v=5";
async function handler(req: Request) {
const { data: vals } = await api(`/v1/search/vals?query=${encodeURIComponent("- [ ]")}`);
let markdown = "# Todos\n";
for (const val of vals) {
if (val.name.startsWith("untitled_")) {
continue;
}
const { readme } = await api<{ readme: string }>(`/v1/vals/${val.id}`);
if (!readme) {
continue;
}
const rows = readme.split("\n");
const todos = rows.filter(row => row.trim().startsWith("- [ ]"));
const link = `https://val.town/v/${val.author.username}/${val.name}`;
markdown = `${markdown}\n## [${val.author.username}/${val.name}](${link})\n${todos.join("\n")}`;
}
return html(await gfm(markdown));
}
export default codeOnValTown(handler);
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.
Comments
stevekrouse avatar

This may be the best val ever created

stevekrouse avatar