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=917&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 18189 results for "function"(3519ms)

social_datadatabase.ts1 match

@fiberplane•Updated 1 month ago
3export const USAGE_TABLE = "socialDataProxy_usage_2";
4
5export async function setupDatabase() {
6 await sqlite.execute(`
7 CREATE TABLE IF NOT EXISTS ${USAGE_TABLE} (

tactfulGreenPigeonmain.tsx3 matches

@jarin1425•Updated 1 month ago
3import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [messages, setMessages] = useState([]);
7 const [input, setInput] = useState("");
93}
94
95function client() {
96 createRoot(document.getElementById("root")).render(<App />);
97}
98if (typeof document !== "undefined") { client(); }
99
100export default async function server(request: Request): Promise<Response> {
101 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
102 const { OpenAI } = await import("https://esm.town/v/std/openai");

assesmentmain.tsx3 matches

@atharv175•Updated 1 month ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function AnalyticsApp() {
6 const [analyticsType, setAnalyticsType] = useState("overall");
7 const [data, setData] = useState(null);
147}
148
149function client() {
150 createRoot(document.getElementById("root")).render(<AnalyticsApp />);
151}
152if (typeof document !== "undefined") { client(); }
153
154export default async function server(request: Request): Promise<Response> {
155 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
156 const KEY = "assesment";

animeStreamingAppmain.tsx8 matches

@HeilAnime•Updated 1 month ago
6const ANIME_API = "https://api.consumet.org/anime/gogoanime/";
7
8function AnimeApp() {
9 const [animes, setAnimes] = useState([]);
10 const [selectedAnime, setSelectedAnime] = useState(null);
12
13 useEffect(() => {
14 async function fetchPopularAnime() {
15 try {
16 const response = await fetch(`${ANIME_API}top`);
24 }, []);
25
26 async function fetchEpisodes(animeId) {
27 try {
28 const response = await fetch(`${ANIME_API}info/${animeId}`);
35 }
36
37 function AnimeCard({ anime }) {
38 return (
39 <div
56 }
57
58 function VideoPlayer({ episode }) {
59 if (!episode) return <div>Select an episode</div>;
60
73 }
74
75 function EpisodeList() {
76 if (!selectedAnime) return null;
77
144}
145
146function client() {
147 createRoot(document.getElementById("root")).render(<AnimeApp />);
148}
149if (typeof document !== "undefined") { client(); }
150
151export default async function server(request: Request) {
152 return new Response(`
153 <html>

webhookbizhoursmain.tsx1 match

@malcolmocean•Updated 1 month ago
1export default async function server(request: Request): Promise<Response> {
2 // Parse the URL to extract query parameters
3 const url = new URL(request.url);

valjsmain.tsx1 match

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

noticiasfidesmain.tsx1 match

@joseforonda•Updated 1 month ago
40};
41
42export default async function(interval: Interval) {
43 let entries: any[] = [];
44 for (let page = 1; page < 4; page++) {

researchAgentmorningAiNewsletter1 match

@saif•Updated 1 month ago
1import { emailValHandler } from "./emailHandler";
2
3export default async function(interval: Interval) {
4 const today = new Intl.DateTimeFormat("en-US", {
5 month: "short",

researchAgentemailHandler2 matches

@saif•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}`,

chatmain.tsx1 match

@sandy•Updated 1 month ago
1export default async function askChatGPT(prompt: string) {
2 const apiKey = "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"; // Use straight quotes
3

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",