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=function&page=1692&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 20183 results for "function"(3541ms)

uptimemain.tsx1 match

@pomdtr•Updated 10 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let reason: string, status: number, end: number;
10 let ok = true;

dynamicSleepmain.tsx1 match

@jonbo•Updated 10 months ago
1export default async function(req: Request): Promise<Response> {
2 // parse the ?seconds=parameter from the url, default to 1 if missing
3 const seconds = Number(new URL(req.url).searchParams.get("seconds")) || 1;

testBasicAuthmain.tsx1 match

@pomdtr•Updated 10 months ago
2import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
3
4function handler(req: Request) {
5 return new Response("You are authenticated!");
6}

audioManagermain.tsx8 matches

@yawnxyz•Updated 10 months ago
43
44export class AudioManager {
45 constructor(apiKey=null, uploadFunction = null, downloadFunction = null) {
46 this.openai = new OpenAI(apiKey);
47 this.uploadFunction = uploadFunction || this.blobUpload;
48 }
49
50 // valtown blob upload function
51 async blobUpload(buffer, key) {
52 try {
111 console.log(blob instanceof Blob); // Should be true
112 console.log(typeof blob); // Should be true
113 console.log(typeof blob.arrayBuffer); // Should be "function"
114 return blob;
115 }
164
165 async uploadAudio(blob, key) {
166 if (!this.uploadFunction) {
167 console.error("No upload function provided to upload audio");
168 return null;
169 }
170
171 // const buffer = await blob.arrayBuffer();
172 const res = await this.uploadFunction(blob, key);
173 if (res) {
174 return res;
180
181
182 // Function to fetch audio data and return as ArrayBuffer
183 async getAudioBuffer(url) {
184 const response = await fetch(url);

brownPelicanmain.tsx1 match

@tmcw•Updated 10 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

CronScrapermain.tsx1 match

@matthiasraimann•Updated 10 months ago
2import { email } from "https://esm.town/v/std/email";
3
4export async function main() {
5 const areas: Area[] = [
6 {

fetchCongressTradeReportsmain.tsx2 matches

@trickster•Updated 10 months ago
9
10
11export async function fetchCongressTradeReports(callback) {
12 const res = await fetchJSON(
13 "https://bff.capitoltrades.com/trades?sortBy=-pubDate"
15 const trades = res.data;
16
17 function isToday(d) {
18 const now = new Date();
19 return (
1```
2export default async function main(req: Request): Promise<Response> {
3 const html = `
4 <!DOCTYPE html>
1```
2// This function returns an HTML response with a "Hello, World!" message styled using CSS
3// to have crazy colors and gradien
4
5export default async function main(req: Request) {
6 const body = `
7 <!DOCTYPE html>
1```
2export default async function main(req: Request): Promise<Response> {
3 // Return a basic HTML response with "Hello, World!" message
4 return new Response("<h1>Hello, World!</h1>", {

getFileEmail4 file matches

@shouser•Updated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 weeks ago
Simple functional CSS library for Val Town
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.