Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bsuccess?q=api&page=946&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 13013 results for "api"(1035ms)

spacexcalendarmain.tsx1 match

@moe•Updated 8 months ago
1import { getLaunches } from "https://esm.town/v/moe/spacexapi"
2import ical from "npm:ical-generator"
3import moment from "npm:moment-timezone"

extremePlumCariboumain.tsx1 match

@ejfox•Updated 8 months ago
154 }
155
156 const client = new ValTown({ apiKey: token });
157 const user = await client.alias.username.retrieve(username);
158

allvalsindexmain.tsx1 match

@ejfox•Updated 8 months ago
96 }
97
98 const client = new ValTown({ apiKey: token });
99 const username = 'ejfox';
100 const user = await client.alias.username.retrieve(username);

sqliteExplorerAppmain.tsx2 matches

@feb•Updated 8 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

sqliteExplorerAppREADME.md1 match

@feb•Updated 8 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

blob_adminREADME.md1 match

@snptrs•Updated 8 months ago
9[![](https://stevekrouse-button.express.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It 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).
12
13# TODO

sketchREADME.md1 match

@ff6347•Updated 8 months ago
37
38## How it works
39The sketch function returns an http handler that sets up a basic page with p5.js added. It then imports your module from the browser and wires up all the exports so p5.js can see them. All the code in your val will run in the browser (except for the default `sketch` export) so you can't call any Deno functions, environment variables, or other server side apis.
40

sketchmain.tsx1 match

@ff6347•Updated 8 months ago
9
10 if (isImage) {
11 const imageUrl = "https://charlypoly-httpapiscreenshotpageexample.web.val.run/?url=" + url.origin
12 // return Response.redirect(imageUrl, 302)
13 const res = await fetch(imageUrl)

calculateTransitAPImain.tsx18 matches

@rochambeau314•Updated 8 months ago
21 }
22
23 const apiKey = Deno.env.get("GOOGLE_MAPS_API_KEY");
24 if (!apiKey) {
25 return new Response(JSON.stringify({ error: "API key is not configured" }), {
26 status: 500,
27 headers: { "Content-Type": "application/json" },
35 const gyms = await blob.getJSON("SF_Gyms");
36
37 const nearestGrocery = await findNearest(origin, groceries, apiKey);
38 const nearestGym = await findNearest(origin, gyms, apiKey);
39
40 const fidiDestination = "548 Market St, San Francisco, CA 94104";
41 const fidiDrivingTime = await getDrivingTime(origin, fidiDestination, apiKey);
42
43 const robloxDestination = "910 Park Pl Ste 300, San Mateo, CA 94403";
44 const robloxDrivingTime = await getDrivingTime(origin, robloxDestination, apiKey, "09:00:00", "Tuesday");
45
46 const samsaraDestination = "1 De Haro St, San Francisco, CA 94103";
47 const samsaraTransitTime = await getTransitTime(origin, samsaraDestination, apiKey);
48
49 const zipCode = await getZipCode(origin, apiKey);
50 const neighborhoodZipMap = await blob.getJSON("SF_Neighborhood_ZIP");
51 const neighborhood = neighborhoodZipMap[zipCode] || "Unknown";
72}
73
74async function findNearest(origin: string, locations: any[], apiKey: string): Promise<any> {
75 const batchSize = 25;
76 let nearestLocation = null;
80 const batch = locations.slice(i, i + batchSize);
81 const destinations = batch.map(location => `${location.gps.lat},${location.gps.lng}`).join('|');
82 const distanceMatrixUrl = `https://maps.googleapis.com/maps/api/distancematrix/json?origins=${encodeURIComponent(origin)}&destinations=${encodeURIComponent(destinations)}&mode=driving&key=${apiKey}`;
83
84 const response = await fetch(distanceMatrixUrl);
86
87 if (data.status !== "OK") {
88 throw new Error(`Distance Matrix API failed. Status: ${data.status}`);
89 }
90
108}
109
110async function getDrivingTime(origin: string, destination: string, apiKey: string, arrivalTime?: string, arrivalDay?: string): Promise<string> {
111 let directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${encodeURIComponent(origin)}&destination=${encodeURIComponent(destination)}&mode=driving&key=${apiKey}`;
112
113 if (arrivalTime && arrivalDay) {
129}
130
131async function getTransitTime(origin: string, destination: string, apiKey: string): Promise<string> {
132 const directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${encodeURIComponent(origin)}&destination=${encodeURIComponent(destination)}&mode=transit&key=${apiKey}`;
133
134 const directionsResponse = await fetch(directionsUrl);
144}
145
146async function getZipCode(address: string, apiKey: string): Promise<string> {
147 const geocodeUrl = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(address)}&key=${apiKey}`;
148 const response = await fetch(geocodeUrl);
149 const data = await response.json();

fluxImageGeneratormain.tsx1 match

@danyslicer•Updated 8 months ago
1// This app uses the fal.ai API to generate images based on user prompts.
2// It features a clean UI with an input field for the prompt and a button to generate the image.
3// The generated image is displayed below the input field.

vapi-minutes-db1 file match

@henrywilliams•Updated 2 days ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 2 days ago
snartapi
mux
Your friendly, neighborhood video API.