Search

Results include substring matches and semantically similar vals. Learn more
robsimmons avatar
aoc_2023_12_sat
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
const INPUT = `
???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1
.trim()
.split("\n");
const PROGRAM = `
easrng avatar
rssViewer
@easrng
rss viewer a basic RSS reader
Express
return { error: e.stack, url };
return html`
AAAAAAMAAAADAAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAOcGl4aQAAAAABCAAAAAxhdjFDgQAcAAAAADhhdXhDAAAA
<title>rss viewer</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
robsimmons avatar
aoc_2023_13
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
.map((grid) => grid.split("\n").map((line) => line.split("")));
const PROGRAM = `
# AOC Day 13 Solution
#builtin NAT_SUCC s
#builtin INT_MINUS minus
tmcw avatar
activitypub
@tmcw
WebFinger This is a not-quite-complete ActivityPub implementation based on my blog post about building an AP implementation . It includes enough to look up bot@tmcw-activitypub.web.val.run on Mastodon and get some basic information.
HTTP
href: `https://${DOMAIN}/u/bot`,
const publicKey = `-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA7LBs3Qyuh93lRboTNXLN
hj4n92oK5Qg4oS8Cc81AXh04hD7nQSSKBhtarbHy2yPXeiKA+H3EGbcflsLvZCo2
B3OPNo2nGTCMyJM8HWDf/7JCOHHcy4tZC1ldjrItkb1YDABWwfoXxyBiGTyTVXjL
robsimmons avatar
aoc_2023_12_dynamic
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
const INPUT = `
???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1
.trim()
.split("\n");
const PROGRAM = `
robsimmons avatar
aoc_2023_9
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
values,
const dusa = new Dusa(`
# AOC Day 9
#builtin INT_MINUS minus
#builtin INT_PLUS plus
robsimmons avatar
aoc_2023_14_feasible
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
.map((line) => line.split(""));
const PROGRAM = `
# AOC Day 14, Part 2 - Take 1
#builtin INT_MINUS minus
#builtin NAT_SUCC s
ehodges avatar
getMcgillEvents
@ehodges
An interactive, runnable TypeScript val by ehodges
Script
export async function getMcgillEvents() {
const url =
"https://www.alumni.mcgill.ca/aoc/events-travel/registration/regwizEventsList.php?location=050%3AMA&school=&dateMonth=&ti
const items = await newRSSItems({
url: url,
karfau avatar
aocXX_00
@karfau
This is a great template if you want to solve the https://adventofcode.com puzzles in a TDD style: dump your puzzle input into the input function copy/paste sample input and output from the page once all assertions pass, the solution is calculated There is one function for each star that can be achieved. Some helpers for common tasks are defined at the end of code: debug , toInt , exctractNumbers , sum , ... ? PS: Did you know advent of code goes as far back as 2015 and you can still solve those puzzles?
Script
This is a great template if you want to solve the <https://adventofcode.com> puzzles in a TDD style:
1. dump your puzzle input into the `input` function
2. copy/paste sample input and output from the page
3. once all assertions pass, the solution is calculated
There is one function for each star that can be achieved.
Some helpers for common tasks are defined at the end of code: `debug`, `toInt`, `exctractNumbers`, `sum`, ... ?
expect(firstStar(`sample input`), "*1 sample 1").to.equal("expected output");
// expect(firstStar(``), "*1 sample 2").to.equal("?");
function firstStar(input: string) {
return "expected output"; // implement :)
karfau avatar
aoc23_06
@karfau
https://adventofcode.com/2023/day/6
Script
https://adventofcode.com/2023/day/6
expect(
firstStar(`Time: 7 15 30
Distance: 9 40 200`),
"*1 sample 1",
).to.equal(288);
// expect(firstStar(``), "*1 sample 2").to.equal("?");
function firstStar(input: string) {
const [times, distances] = input.split("\n").map(extractNumbers);
const winnings: number[] = times.map((time, i) => {
robsimmons avatar
aoc_2023_14_infeasible
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
.map((line) => line.split(""));
const dusa = new Dusa(`
# AOC Day 14, Part 2 - Take 1
#builtin INT_MINUS minus
#builtin NAT_SUCC s
karfau avatar
aoc15_06
@karfau
https://adventofcode.com/2015/day/6
Script
https://adventofcode.com/2015/day/6
// expect(firstStar(`turn on 0,0 through 999,999`), "*1 sample 1").to.equal(1_000_000);
// expect(firstStar(`toggle 0,0 through 999,0`), "*1 sample 2").to.equal(1_000);
// expect(firstStar(`turn off 499,499 through 500,500`), "*1 sample 3").to.equal(0);
// expect(firstStar(``), "*1 sample 2").to.equal("?");
function firstStar(input: string) {
return "expected output"; // implement :)
// as as soon as the assertions pass, the solution is calculated
console.log("solution *1:", firstStar(input()));
expect(secondStar(``), "*2 sample 1").to.equal("?");
karfau avatar
aoc23_07
@karfau
https://adventofcode.com/2023/day/7
Script
https://adventofcode.com/2023/day/7
let verbose = true;
const CARDS = "23456789TJQKA";
const CARDSJ = "J23456789TQKA";
const ORDERC = "ABCDEFGHIJKLM";
const FIVE_OAK = 6;
const FOUR_OAK = 5;
const FULL_HOUSE = 4;
const THREE_OAK = 3;
const TWO_PAIRS = 2;
karfau avatar
aoc23_05
@karfau
https://adventofcode.com/2023/day/5 Oh boy, what a tedious one. I don't see any quick and easy optimization strategies here. the parsing is the most tedious part of this. The first part went way more smoothly than I initially thought, by splitting the different steps into smaller pieces. But the second part is a hard nut to crack. So many runtime/performance issues because the numbers are so "big" that my intail approach no longer works. Last nut I finally cracked was in v28 by running the following on a powerful desktop machine for nearly an hour: deno run https://esm.town/v/karfau/aoc23_05?v=28 (that is the module URL) to get the correct solution.
Script
Last nut I finally cracked was in v28 by running the following on a powerful desktop machine for nearly an hour:
`deno run https://esm.town/v/karfau/aoc23_05?v=28` (that is the module URL)
to get the correct solution.
vtdocs avatar
getGithubUserViaOctokit
@vtdocs
An interactive, runnable TypeScript val by vtdocs
Script
export const getGithubUserViaOctokit = async (username: string) => {
const { Octokit } = await import("npm:@octokit/core");
const octokit = new Octokit();