1import { fetch } from "https://esm.town/v/std/fetch";
2
3// https://www.schools.nyc.gov/docs/default-source/school-menus/2023-2024/september/pre-k---8-express-hot-lunch-menu
4//
5export let fetchDOEMenu: (opts: {schoolYear: `${number}-${number}`, month: string, menuType: string}) = (async ({schoolYear, month, menuType}) => {
6 const resp = await fetch(
7 `https://www.schools.nyc.gov/docs/default-source/school-menus/${schoolYear}/${month}/${menuType}`,
8 {
8 isInterval?: boolean;
9 }) =>
10 `fetch('https://api.val.town/eval/@vez.editVal(${JSON.stringify(body)})')`;
11 return res.send(`<h1>Shitty Val Town 2</h1>
12${(await getAllVals("@vez")).map(({ code, name }) => {
13 const editorId = `${name}-editor`;
14 const onClick = `(document.getElementById('${name}-button').textContent = 'save 🔄'), fetch('https://api.val.town/eval/@vez.editVal', { method: 'POST', body: JSON.stringify({ name: '${name}', code: document.getElementById('${editorId}').value })}).then(()=>(document.getElementById('${name}-button').textContent = 'save ✅'))`;
15 return `<h2>${name}</h2>
16<textarea id="${editorId}" rows="20" cols="120">${escapeHtml(
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function postTweet({ accessToken, text, reply }: {
8 };
9}) {
10 return fetchJSON(`https://api.twitter.com/2/tweets`, {
11 method: "POST",
12 headers: {
36submitButton.addEventListener("click", async () => {
37 const webhookUrl = webhookUrlInput.value;
38 const response = await fetch(webhookUrl, {
39 method: "POST",
40 });
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let requestGoogleNgram = async (
8 smoothing = 5,
9) => {
10 let response = await fetch(
11 `https://books.google.com/ngrams/json?content=${query}&year_start=${year_start}&year_end=${year_end}&corpus=${corpus}&smoothing=${smoothing}`,
12 ).then((p) => p.json());
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function wttrGetForecast({
7 const wttrLocation = encodeURIComponent(location);
8 const wttrLang = encodeURIComponent(languageCode);
9 const res = await fetch(
10 `https://wttr.in/${wttrLocation}?lang=${wttrLang}&format=j1`
11 );
14 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
15 let client = new LemmyHttp(`https://${instance}`, {
16 fetchFunction: fetch,
17 });
18 const quote = unusedQuotes.pop();
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function dohRequestIpAddr(domain) {
4 let req = await fetch(`https://1.1.1.1/dns-query?name=${domain}`, {
5 headers: { "Accept": "application/dns-json" },
6 });
1import { fetchJSON } from "https://esm.town/v/swyx/fetchJSON";
2
3export let testcase1 = fetchJSON('https://api.val.town/eval/@stevekrouse.messages')
4
5// export state = () => {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Explore the Star Wars universe, from StarWarsAPI
4export let starWars = fetchJSON(
5 "https://swapi.dev/api/people/1/"
6);