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%22Optional%20title%22?q=function&page=104&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 21024 results for "function"(1521ms)

my-first-val04_email.tsx1 match

@dieberuo•Updated 3 days ago
2// Click "Run", copy and paste the email address and send an email to it.
3// This example will log the email details received.
4export default async function emailHandler(email: Email){
5 console.log("Email received!", email.from, email.subject, email.text);
6 for (const file of email.attachments) {

my-first-val03_cron.tsx1 match

@dieberuo•Updated 3 days ago
2// Configure the timer with the 🕒 icon in the top right.
3// This example just logs the current time.
4export function scheduledHandler() {
5 const timestamp = new Date().toISOString();
6 console.log(`Cron val executed at: ${timestamp}`);

my-first-val02_http.tsx1 match

@dieberuo•Updated 3 days ago
2// Access it via its public URL (you can also pick a nicer subdomain).
3// Try adding ?name=YourName to the URL!
4export default function httpHandler(req: Request): Response {
5 const url = new URL(req.url);
6 const name = url.searchParams.get("name") || "Friend";

my-first-val01_script.tsx1 match

@dieberuo•Updated 3 days ago
1// This script returns a random fun fact
2// You can run scripts manually in this view or call it from other vals.
3export default function getRandomFact() {
4 const funFacts = [
5 "Honey never spoils.",

untitled-1352new-file-7671.tsx1 match

@gmcabrita•Updated 3 days ago
1export default async function(req: Request): Promise<Response> {
2 for await (const { isFile, name } of Deno.readDir("."))
3 console.log(name);

untitled-1352index.html2 matches

@gmcabrita•Updated 3 days ago
106 const defaultNS = xmlDoc.documentElement.namespaceURI;
107
108 // Custom namespace resolver function for XPath
109 function lookupNamespace(prefix) {
110 if (prefix === 'h') return defaultNS; // HL7 namespace
111 if (prefix === 'xsi') return 'http://www.w3.org/2001/XMLSchema-instance';

ModuleResolutionHackscustom-fs.ts1 match

@wolf•Updated 3 days ago
1export function readFileSync(path: string, options?: string | { encoding?: string; flag?: string }): string | Buffer {
2 console.log(`Mock readFileSync called for: ${path}`);
3 return "hello";
requests-in-space

requests-in-spacenew-file-6480.tsx1 match

@shouser•Updated 3 days ago
1export default async function(interval: Interval) {
2 console.log(interval);
3}

ModuleResolutionHacksuses-nodefs.ts1 match

@wolf•Updated 3 days ago
1import fs from "node:fs";
2
3export function readTest() {
4 const data = fs.readFileSync("test", "utf8");
5 console.log(data);

untitled-5961Modal.tsx1 match

@toowired•Updated 3 days ago
186
187// Modal Hook
188export function useModal() {
189 const [isOpen, setIsOpen] = React.useState(false);
190

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 4 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.