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=2112&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 22813 results for "function"(1750ms)

connect4_random_agentmain.tsx1 match

@saolsen•Updated 1 year ago
2import { connect4_agent } from "https://esm.town/v/saolsen/connect4_agent";
3
4function rand_action(state: connect4.State): connect4.Action {
5 let player = state.next_player;
6 while (true) {

connect4_agentmain.tsx1 match

@saolsen•Updated 1 year ago
5export type AsyncAgent = (state: connect4.State) => Promise<connect4.Action>;
6
7export function connect4_agent(agent: Agent | AsyncAgent) {
8 const app = new Hono();
9 app.get("/", (c) => c.json("connect4 agent"));

processFeedmain.tsx2 matches

@willthereader•Updated 1 year ago
1import { untitled_blackCrayfish } from "https://esm.town/v/stevekrouse/untitled_blackCrayfish?v=1";
2
3async function processFeed() {
4 let rssData = await untitled_blackCrayfish; // Line 1
5 console.log("Keys of rssData.rss:", Object.keys(rssData.rss)); // Log the keys of rssData.rss
24}
25
26processFeed().then(output => console.log(output)); // Call the function and print the output to the console

testEmail2main.tsx1 match

@tmcw•Updated 1 year ago
3import { testEmails } from "https://esm.town/v/stevekrouse/testEmails";
4
5export async function testEmail2(e: Email) {
6 await set("testEmails", [...testEmails, {
7 ...e,

untitled_amberLeopardmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import createPlugin from "https://esm.sh/@extism/extism";
2
3export default async function(req: Request): Promise<Response> {
4 const plugin = await createPlugin(
5 "https://cdn.modsurfer.dylibso.com/api/v1/module/ec17c9afde08aa9e7fa857fe2c9cbb9206e3a3dbec98429ceebd3421de7070da.wasm",

commentsmain.tsx2 matches

@vez•Updated 1 year ago
5const KEY = import.meta.url.split("?")[0];
6
7export async function addComment(str) {
8 const comments = await blob.getJSON(KEY) as Array<string> ?? [];
9 comments.push(str);
11 await email({ text: "New Comment Alert!: " + str });
12}
13export async function getComments() {
14 return await blob.getJSON(KEY) as Array<string> ?? [];
15}

untitled_pinkRoundwormmain.tsx2 matches

@stevekrouse•Updated 1 year ago
5const KEY = import.meta.url.split("?")[0];
6
7export async function addComment(str) {
8 const comments = await blob.getJSON(KEY) as Array<string> ?? [];
9 comments.push(str);
11 await email({ text: "New Comment Alert!: " + str });
12}
13export async function getComments() {
14 return await blob.getJSON(KEY) as Array<string> ?? [];
15}

reportCommentsmain.tsx1 match

@vez•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3export function reportComments() {
4 email({ text: "elliot.website reported comment alert!" });
5}

randomMediaUrlmain.tsx1 match

@jamiedubs•Updated 1 year ago
1// select random record from "files" based on format
2export default async function(req: Request): Promise<Response> {
3 const format = new URL(req.url).searchParams.get("format");
4
1export const script_6sbfbg98wajm0b51pjunnu2pwj8nbi98 = (async function() {
2 const rosters = {
3 "Zack": ["PHI", "WSH", "IND", "TB", "LAR", "TEN", "HOU"],

getFileEmail4 file matches

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

tuna8 file matches

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