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/%22https:/unpkg.com/three@0.160.0/build/three.min.js//%22/inference?q=function&page=1&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 40661 results for "function"(1565ms)

untitled-2672main.ts2 matches

@bat•Updated 29 mins ago
5const URL = "https://thatskyshop.com/products/manatee-plush";
6
7export default async function () {
8 const html = await fetchText(URL);
9 const $ = cheerio.load(html);
21}
22
23async function fetchText(url: string, options?: any) {
24 const response = await fetch(url, {
25 redirect: "follow",

tasca_chatmain.ts1 match

@bluemax•Updated 1 hour ago
4const openai = new OpenAI();
5
6export default async function (req: Request): Promise<Response> {
7 const { question } = await req.json();
8

campanhapsdalcoframain.ts3 matches

@nmsilva•Updated 1 hour ago
683};
684
685function App() {
686 return (
687 <>
691}
692
693function client() {
694 createRoot(document.getElementById("root")).render(<App />);
695}
699}
700
701export default async function server(request: Request): Promise<Response> {
702 return new Response(
703 `

manifoldHttpmain.ts6 matches

@dcm31•Updated 2 hours ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [url, setUrl] = useState("");
7 const [result, setResult] = useState<any>(null);
15 }, []);
16
17 function saveKey() {
18 localStorage.setItem("manifoldApiKey", apiKey);
19 alert("API key saved locally");
20 }
21
22 async function handleSubmit(e: React.FormEvent) {
23 e.preventDefault();
24 setResult(null);
33 }
34
35 async function handleBetTest() {
36 if (!result || !apiKey || betAmount <= 0) return;
37 setStatus("Placing test bet on first option...");
117}
118
119function client() {
120 createRoot(document.getElementById("root")!).render(<App />);
121}
123export { client };
124
125export default async function server(req: Request): Promise<Response> {
126 const { pathname } = new URL(req.url);
127

manifoldSummain.ts1 match

@dcm31•Updated 2 hours ago
1export default async function manifoldSum(url: string) {
2 // Extract slug from manifold URL
3 const parts = url.split("/");

gatemain.ts6 matches

@know•Updated 2 hours ago
42const openai = new OpenAI();
43
44async function callAI(
45 fact: string,
46 prompt: string,
104}
105
106async function buildTreeInBackground(jobId: string, rootNode: FactNode) {
107 const normalize = (p: Prerequisite) => ({
108 fact: String(p.fact || "").trim(),
178
179// --- HTML & FRONTEND ---
180function generateHtml(sourceUrl: string) {
181 return `<!DOCTYPE html>
182<html lang="en">
398 const MAX_DEPTH = 5;
399
400 function TreeNode({ node, isLive }) {
401 const [isCollapsed, setIsCollapsed] = useState(false);
402
427 }
428
429 function App() {
430 const [view, setView] = useState("input");
431 const [jobId, setJobId] = useState(null);
547
548// --- MAIN VAL HANDLER ---
549export default async function (req: Request) {
550 const url = new URL(req.url);
551 const action = url.searchParams.get("action");

h6-ValTownLogo.tsx1 match

@werewolf006•Updated 3 hours ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function ValTownLogo () {
4 return (
5 <svg

h6-val-summary.ts1 match

@werewolf006•Updated 3 hours ago
5 * Get usage data for a specific val
6 */
7export async function getValSummary(valId: string) {
8 // Get summary data for the val from the usage table
9 const usageSummaryResult = await sqlite.execute(`

h6-val-detail.ts1 match

@werewolf006•Updated 3 hours ago
36}
37
38export function renderValDetail(valId: string, summary: ValSummary, requests: UsageRequest[] = []): string {
39 // Generate the content
40 const content = `

h6-useUser.tsx1 match

@werewolf006•Updated 3 hours ago
3const USER_ENDPOINT = "/api/user";
4
5export function useUser() {
6 const [data, setData] = useState<any>(null);
7 const [loading, setLoading] = useState(true);

ratelimit4 file matches

@unkey•Updated 1 month ago
Rate limit your serverless functions

discordWebhook2 file matches

@stevekrouse•Updated 2 months ago
Helper function to send Discord messages
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.