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/?q=function&page=658&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 8271 results for "function"(632ms)

localTestindex.http.tsx1 match

@maxm•Updated 1 month ago
13
14
15export default async function(req: Request): Promise<Response> {
16 if (req.method === "POST") {
17 await sqlite.execute(`UPDATE ${table} SET count = count + 1 WHERE id = 1`);

progressiveRedBasstest1 match

@shouser•Updated 1 month ago
1export default async function(req: Request): Promise<Response> {
2 throw new Error("hi");
3 return Response.json({ ok: true });

researchAgentemailHandler2 matches

@kamalnrf•Updated 1 month ago
4import { OpenAI } from "npm:openai";
5
6function pm(...lines: string[]): string {
7 return lines.join("\n");
8}
9
10export async function emailValHandler(inboundEmail: Email) {
11 const userPrompt = pm(
12 `From: ${inboundEmail.from}`,

forky-1741889903243App.tsx1 match

@shouser•Updated 1 month ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [projectUrl, setProjectUrl] = useState("");
6 const [apiToken, setApiToken] = useState("");

forky-1741889903243index.ts2 matches

@shouser•Updated 1 month ago
121});
122
123function parseValTownProjectURL(url) {
124 // Use the URL constructor to parse the URL
125 const { pathname } = new URL(url);
135}
136
137async function getFilesWithContent(authenticatedVT, files, projectId, newProjectId) {
138 console.log("files:", files);
139 const nonDirectoryFiles = files.filter(file => file.type !== "directory");

researchAgentmorningAiNewsletter1 match

@kamalnrf•Updated 1 month ago
4const { author, name } = extractValInfo(import.meta.url);
5
6export default async function(interval: Interval) {
7 const today = new Intl.DateTimeFormat("en-US", {
8 month: "short",

tank-1741888685515tank.html1 match

@shouser•Updated 1 month ago
1export default function server(request: Request): Response {
2 return new Response(
3 `<!DOCTYPE html>

tank-1741888685515tank.js4 matches

@shouser•Updated 1 month ago
77}
78
79function preload() {}
80
81function setup(faceCount = 20) {
82 createCanvas(windowWidth, windowHeight);
83 console.log("setup");
96}
97
98function draw() {
99 background(0);
100 var i;
106}
107
108function setFaceCount() {
109 faceCount = document.getElementById('faceCount').value;
110 console.log(faceCount)

import_from_githubApp.tsx1 match

@shouser•Updated 1 month ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [projectUrl, setProjectUrl] = useState("");
6 const [apiToken, setApiToken] = useState("");

alexBlogsLayout.tsx1 match

@charmaine•Updated 1 month ago
2import type { ReactNode } from "npm:react@18.2.0";
3
4export function Layout({ children }: { children: ReactNode }) {
5 return (
6 <html lang="en">

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago