moderateRoseReptilemain.tsx2 matches
28type TwoLettersString = `${alfabet}${alfabet}`;
2930type CapitalizeTwoLetterString<T extends string, U extends TwoLettersString> = T extends U ? Capitalize<T> : never;
3132type fullName = `${CapitalizeTwoLetterString<"as", TwoLettersString>} ${CapitalizeTwoLetterString<
33"df",
34TwoLettersString
30type Test<T extends string = TwoLettersString> = T;
3132type CapitalizeTwoLetterString<T extends string, U extends string = TwoLettersString> = T extends U ? Capitalize<T>
33: never;
3435type fullName = `${CapitalizeTwoLetterString<"a">} ${CapitalizeTwoLetterString<"df", TwoLettersString>}`;
3637const fn: never = "1" as undefined as never;
moderateRoseReptilemain.tsx2 matches
28type TwoLettersString = `${alfabet}${alfabet}`;
2930type CapitalizeTwoLetterString<T extends string, U extends TwoLettersString> = T extends U ? Capitalize<T> : never;
3132type fullName = `${CapitalizeTwoLetterString<"as", TwoLettersString>} ${CapitalizeTwoLetterString<
33"df",
34TwoLettersString
22};
2324const GH = `https://api.github.com/repos`;
25const GH_STORAGE = "https://raw.githubusercontent.com";
2627const now = () => new Date().toISOString().replace("T", " ").replace("Z", "");
2829export class GitHubAPI {
30#token: string | undefined;
31#contents: string;
180}
181182const GHDB_API_KEY = env.GHDB_API_KEY;
183if (!GHDB_API_KEY) throw new Error("GHDB_API_KEY is not defined");
184185const gh = new GitHubAPI();
186187const application = new Hono();
190191application.get("/data/:path{.+$}", async (c) => {
192const headers = c.req.header("GHDB_API_KEY");
193if (headers !== GHDB_API_KEY) throw new HTTPException(403, { message: "forbidden" });
194195const path = c.req.param("path");
207208application.get("/raw/:path{.+$}", async (c) => {
209const headers = c.req.header("GHDB_API_KEY");
210if (headers !== GHDB_API_KEY) throw new HTTPException(403, { message: "forbidden" });
211212const path = c.req.param("path");
223224application.delete("/data/:path{.+$}", async (c) => {
225const headers = c.req.header("GHDB_API_KEY");
226if (headers !== GHDB_API_KEY) throw new HTTPException(403, { message: "forbidden" });
227228const path = c.req.param("path");
236237application.post("/data/:path{.+$}", async (c) => {
238const headers = c.req.header("GHDB_API_KEY");
239if (headers !== GHDB_API_KEY) throw new HTTPException(403, { message: "forbidden" });
240241const path = c.req.param("path");
250251application.put("/data/:path{.+$}", async (c) => {
252const headers = c.req.header("GHDB_API_KEY");
253if (headers !== GHDB_API_KEY) throw new HTTPException(403, { message: "forbidden" });
254255const path = c.req.param("path");
3The key is a file path within a repository. The value is the file content.
45The val needs a GitHub token to access the GitHub API, the account name
6and the repository name.
78Also, the val needs GHDB_API_KEY variable. This value defines the exptected
9value of the GHDB_API_KEY header to allow access to the endpoints.
1011Endpoints:
design32x32bitmapmain.tsx1 match
461<meta name="viewport" content="width=device-width, initial-scale=1.0">
462<title>1-Bit Bitmap Editor</title>
463<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
464<style>${css}</style>
465</head>
23const browser = await puppeteer.connect({
4browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
5});
6
blob_adminREADME.md1 match
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
1011It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
1213# TODO
blob_adminREADME.md1 match
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
1011It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
1213# TODO
calculateTransitTimeValmain.tsx28 matches
1// This val calculates driving/transit time from given origins to the nearest grocery store, gym, FiDi, Roblox HQ, and Samsara in San Francisco.
2// It uses data from SF_Grocery and SF_Gyms blobs, and the Google Maps Directions API for travel times.
3// It also looks up the neighborhood based on the ZIP code using the SF_Neighborhood_ZIP blob.
4// Results are saved and displayed for each new address added, with options to delete individual results.
219}
220221const apiKey = Deno.env.get("GOOGLE_MAPS_API_KEY");
222if (!apiKey) {
223console.error("API key is missing");
224return new Response(JSON.stringify({ error: "API key is not configured" }), {
225headers: { "Content-Type": "application/json" },
226});
237238console.log("Finding nearest grocery");
239const nearestGrocery = await findNearest(origin, groceries, apiKey);
240console.log("Nearest grocery:", nearestGrocery);
241242console.log("Finding nearest gym");
243const nearestGym = await findNearest(origin, gyms, apiKey);
244console.log("Nearest gym:", nearestGym);
245246console.log("Calculating driving time to FiDi");
247const fidiDestination = "548 Market St, San Francisco, CA 94104";
248const fidiDrivingTime = await getDrivingTime(origin, fidiDestination, apiKey);
249console.log("FiDi driving time:", fidiDrivingTime);
250251console.log("Calculating driving time to Roblox");
252const robloxDestination = "910 Park Pl Ste 300, San Mateo, CA 94403";
253const robloxDrivingTime = await getDrivingTime(origin, robloxDestination, apiKey, "09:00:00", "Tuesday");
254console.log("Roblox driving time:", robloxDrivingTime);
255256console.log("Calculating transit time to Samsara");
257const samsaraDestination = "1 De Haro St, San Francisco, CA 94103";
258const samsaraTransitTime = await getTransitTime(origin, samsaraDestination, apiKey);
259console.log("Samsara transit time:", samsaraTransitTime);
260261console.log("Extracting ZIP code and looking up neighborhood");
262const zipCode = await getZipCode(origin, apiKey);
263const neighborhoodZipMap = await blob.getJSON("SF_Neighborhood_ZIP");
264const neighborhood = neighborhoodZipMap[zipCode] || "Unknown";
315}
316317async function findNearest(origin: string, locations: any[], apiKey: string): Promise<any> {
318console.log(`Finding nearest location among ${locations.length} options`);
319const batchSize = 25; // Google Maps API typically allows up to 25 destinations per request
320let nearestLocation = null;
321let shortestTime = Infinity;
324const batch = locations.slice(i, i + batchSize);
325const destinations = batch.map(location => `${location.gps.lat},${location.gps.lng}`).join("|");
326const distanceMatrixUrl = `https://maps.googleapis.com/maps/api/distancematrix/json?origins=${
327encodeURIComponent(origin)
328}&destinations=${encodeURIComponent(destinations)}&mode=driving&key=${apiKey}`;
329330console.log(`Fetching from Distance Matrix API for batch ${i / batchSize + 1}`);
331const response = await fetch(distanceMatrixUrl);
332const data = await response.json();
333console.log("Distance Matrix API response status:", data.status);
334335if (data.status !== "OK") {
336console.error("Distance Matrix API failed:", data);
337throw new Error(`Distance Matrix API failed. Status: ${data.status}`);
338}
339362origin: string,
363destination: string,
364apiKey: string,
365arrivalTime?: string,
366arrivalDay?: string,
367): Promise<string> {
368let directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${
369encodeURIComponent(origin)
370}&destination=${encodeURIComponent(destination)}&mode=driving&key=${apiKey}`;
371372if (arrivalTime && arrivalDay) {
388}
389390async function getTransitTime(origin: string, destination: string, apiKey: string): Promise<string> {
391const directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${
392encodeURIComponent(origin)
393}&destination=${encodeURIComponent(destination)}&mode=transit&key=${apiKey}`;
394395const directionsResponse = await fetch(directionsUrl);
405}
406407async function getZipCode(address: string, apiKey: string): Promise<string> {
408const geocodeUrl = `https://maps.googleapis.com/maps/api/geocode/json?address=${
409encodeURIComponent(address)
410}&key=${apiKey}`;
411const response = await fetch(geocodeUrl);
412const data = await response.json();