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/image-url.jpg%20%22Image%20title%22?q=function&page=2554&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 28926 results for "function"(1900ms)

perfmain.tsx3 matches

@stevekrouse•Updated 10 months ago
6import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
7
8// Utility functions
9const performSingleRequest = async (url) => {
10 const start = performance.now();
46};
47
48// Helper function to safely format numbers
49const safeToFixed = (number, decimalPlaces) => {
50 return number !== undefined && number !== null
286}
287
288export default async function(req: Request): Promise<Response> {
289 const stream = await renderToReadableStream(<App />, { bootstrapModules: [import.meta.url] });
290 return new Response(stream, { headers: { "content-type": "text/html" } });
1// This val retrieves the weather in Brooklyn, NY using the MetaWeather API
2
3export default async function main(req: Request): Promise<Response> {
4 const response = await fetch("https://www.metaweather.com/api/location/2459115/");
5 const weatherData = await response.json();
1// This val retrieves the weather in Brooklyn, NY using the MetaWeather API
2
3export default async function main(req: Request): Promise<Response> {
4 const response = await fetch("https://www.metaweather.com/api/location/2459115/");
5 const weatherData = await response.json();
1// This val will respond to HTTP requests with a simple "Hello, World!" message
2
3export default async function main(req: Request): Promise<Response> {
4 return new Response("Hello, World!", {
5 headers: { "Content-Type": "text/plain" },
3// to retrieve weather information for a specific location
4
5export default async function main(req: Request): Promise<Response> {
6 const apiUrl = "https://api.open-meteo.com/v1/forecast?latitude=40.6782&longitude=-73.9442&hourly=temperature_2m&current_weather=true";
7
1// This val will respond to HTTP requests with a simple "Hello, world!" message.
2
3export default async function main(req: Request): Promise<Response> {
4 return new Response("Hello, world!");
5}
2// We will use Deno's built-in HTTP module to create the server and handle incoming requests.
3
4// Define the main function that will handle HTTP requests
5export default async function main(_req: Request) {
6 // Return a simple Response with "Hello world"
7 return new Response("Hello world");
1// This HTTP val responds to all requests with "Hello world"
2
3export default async function main(req: Request): Promise<Response> {
4 return new Response("Hello world", { headers: { "Content-Type": "text/plain" } });
5}
1// This val responds with "Hello world" to all incoming requests
2
3export default async function (req: Request): Promise<Response> {
4 return new Response("Hello world");
5}
1// This val responds to HTTP requests with a colorful HTML message using gradients
2export default async function main(req: Request): Promise<Response> {
3 const html = `
4 <html>
tuna

tuna9 file matches

@jxnblk•Updated 13 hours ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.