3import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
4
5export default async function() {
6 let { data: articles } = await api(`/v1/search/vals?query=${encodeURIComponent("@vtIdeas")}`);
7
6import { html } from "https://esm.town/v/stevekrouse/html?v=5";
7
8export async function examplePost(req: Request) {
9 const { author, name } = extractValInfo(import.meta.url);
10
1import { email } from "https://esm.town/v/std/email?v=11";
2
3export default async function emailJasonAboutValTown(interval: Interval) {
4 // no-op if it's not 2024: I don't want to email Jason every year!
5 const is2024 = new Date().getFullYear() === 2024;
10 <p>Hey Jason, following up on our conversation back in December about getting Steve Krouse on LWJ to explore Val Town with you!</p>
11 <p>Hope all is well, Pete</p>
12 <p><em>(This email was sent programmatically via a val.town scheduled function.)</em></p>
13 </main>
14 `;
7import { html } from "https://esm.town/v/stevekrouse/html?v=5";
8
9export async function examplePost(req: Request) {
10 const { author, name } = extractValInfo(import.meta.url);
11 const { code, readme } = await api(`/v1/alias/${author}/${name}`);
3import { html } from "https://esm.town/v/stevekrouse/html?v=5";
4
5export async function examplePost(req: Request) {
6 const { author, name } = extractValInfo(import.meta.url);
7
2import Jimp from "npm:jimp";
3
4export async function download(req: Request): Promise<Response> {
5 // Return the picture as a response
6 const searchParams = new URL(req.url).searchParams;
22).to.equal(6);
23
24function firstStar(input: string) {
25 const [directions, ...mapRaw] = input.split("\n").filter((line) => Boolean(line.trim()));
26 const map = Object.fromEntries(mapRaw.map(line => {
58).to.equal(6);
59// expect(secondStar(``), "*2 sample 2").to.equal("?");
60function secondStar(input: string) {
61 const [directions, ...mapRaw] = input.split("\n").filter((line) => Boolean(line.trim()));
62 const map = Object.fromEntries(mapRaw.map(line => {
84console.log("solution *2:", secondStar(input()));
85
86function input() {
87 return `LLLRRLRRRLLRRLRRLLRLRRLRRRLRRLRRLRRRLRLRRLRLRRLRRLLRRLRLLRRLLLRRRLRRLRLRLRRRLRLLRRLRRRLRRLRRLRRLRLLRLLRRLRRRLRRLRLRRLRRRLRRLLRLLRRLRRRLLRRRLRLRRRLLRLRRLRRLLRRLRRLLLRRRLRLRRRLRRLLRLRRLRLLRRRLRLRLLRLRRRLRLRRRLRRLRLRLLRLRRRLRRLRRRLRRRLRLRRRLRRRLLLLRLRLRRRLLLRLRRRLRRLRLRRLLRLLRRRR
88
831}
832
833function toInt(s: string) {
834 return parseInt(s);
835}
836function extractNumbers(line: string) {
837 return line.match(/\d+/g).map(toInt);
838}
839// [0,1,2,3].reduce(sum, 0) => 6
840function sum(sum: number, current: number) {
841 return sum + current;
842}
843// wrap a value to print and return it
844function debug<T>(value: T, msg = "debug"): T {
845 console.log(msg, value);
846 return value;
9export const githubEmojiNames = (): string[] => Object.keys(GITHUB_EMOJIS);
10
11export default async function githubEmoji(req: Request): Promise<Response> {
12 const contentType = req.headers.get("Content-Type");
13
25// expect(firstStar(``), "*1 sample 2").to.equal("?");
26
27function firstStar(input: string) {
28 const bids = Object.fromEntries(
29 input.split("\n").map(l => {
61expect(secondStar(sample), "*2 sample 1").to.equal(5905);
62// expect(secondStar(``), "*2 sample 2").to.equal("?");
63function withJokers(jokers: number, first: number, second: number) {
64 switch (first) {
65 case 5:
83}
84
85function secondStar(input: string) {
86 const bids = Object.fromEntries(
87 input.split("\n").map(l => {
110console.log("solution *2:", secondStar(input()));
111
112function input() {
113 return `Q94A5 121
114AQ56Q 611
1113}
1114
1115function toInt(s: string) {
1116 return parseInt(s);
1117}
1118function extractNumbers(line: string) {
1119 return line.match(/\d+/g).map(toInt);
1120}
1121// [0,1,2,3].reduce(sum, 0) => 6
1122function sum(sum: number, current: number) {
1123 return sum + current;
1124}
1125// wrap a value to print and return it
1126function debug<T>(value: T, msg = "debug"): T {
1127 console.log(msg, value);
1128 return value;
4// expect(firstStar(``), "*1 sample 2").to.equal("?");
5
6function firstStar(input: string) {
7 return "expected output"; // implement :)
8}
12expect(secondStar(``), "*2 sample 1").to.equal("?");
13// expect(secondStar(``), "*2 sample 2").to.equal("?");
14function secondStar(input: string) {
15 return "?";
16}
17console.log("solution *2:", secondStar(input()));
18
19function input() {
20 return ``;
21}
22
23function toInt(s: string) {
24 return parseInt(s);
25}
26function extractNumbers(line: string) {
27 return line.match(/\d+/g).map(toInt);
28}
29// [0,1,2,3].reduce(sum, 0) => 6
30function sum(sum: number, current: number) {
31 return sum + current;
32}
33// wrap a value to print and return it
34function debug<T>(value: T, msg = "debug"): T {
35 console.log(msg, value);
36 return value;