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/$%7Bsuccess?q=function&page=1726&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 22789 results for "function"(1225ms)

productiveRosePeacockmain.tsx9 matches

@stevekrouse•Updated 5 months ago
15 "recipe ingredient converter and scaler",
16 "morse code translator with audio output",
17 "random quote generator with tweet functionality",
18 "personal finance tracker with basic charts",
19 "multiplayer rock-paper-scissors game",
20];
21
22function Dashboard() {
23 const [stats, setStats] = useState<{
24 totalGenerations: number;
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
115}
116
117function App() {
118 const [prompt, setPrompt] = useState(
119 STARTER_PROMPTS[Math.floor(Math.random() * STARTER_PROMPTS.length)],
141 });
142
143 async function handleSubmit(e: React.FormEvent) {
144 e.preventDefault();
145 setLoading(true);
174 }
175
176 function handleVersionChange(direction: "back" | "forward") {
177 const { currentVersionIndex, versions } = versionHistory;
178
305}
306
307function client() {
308 const path = window.location.pathname;
309 const root = createRoot(document.getElementById("root")!);
320}
321
322function extractCodeFromFence(text: string): string {
323 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
324 return htmlMatch ? htmlMatch[1].trim() : text;
325}
326
327export default async function server(req: Request): Promise<Response> {
328 // Dynamic import for SQLite to avoid client-side import
329 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

prodigiousBrownImpalamain.tsx9 matches

@stevekrouse•Updated 5 months ago
15 "recipe ingredient converter and scaler",
16 "morse code translator with audio output",
17 "random quote generator with tweet functionality",
18 "personal finance tracker with basic charts",
19 "multiplayer rock-paper-scissors game",
20];
21
22function Dashboard() {
23 const [stats, setStats] = useState<{
24 totalGenerations: number;
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
115}
116
117function App() {
118 const [prompt, setPrompt] = useState(
119 STARTER_PROMPTS[Math.floor(Math.random() * STARTER_PROMPTS.length)],
141 });
142
143 async function handleSubmit(e: React.FormEvent) {
144 e.preventDefault();
145 setLoading(true);
174 }
175
176 function handleVersionChange(direction: "back" | "forward") {
177 const { currentVersionIndex, versions } = versionHistory;
178
305}
306
307function client() {
308 const path = window.location.pathname;
309 const root = createRoot(document.getElementById("root")!);
320}
321
322function extractCodeFromFence(text: string): string {
323 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
324 return htmlMatch ? htmlMatch[1].trim() : text;
325}
326
327export default async function server(req: Request): Promise<Response> {
328 // Dynamic import for SQLite to avoid client-side import
329 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

BestTime2postmain.tsx5 matches

@taurusismagic•Updated 5 months ago
11].slice(0, 6); // Limit to first 6 platforms for performance
12
13function useTimeout(callback, delay) {
14 useEffect(() => {
15 if (delay !== null) {
20}
21
22function App() {
23 const [step, setStep] = useState(1);
24 const [formData, setFormData] = useState({
202}
203
204function renderApp() {
205 const root = document.getElementById("root");
206 if (root) {
211}
212
213function client() {
214 if (document.readyState === "loading") {
215 document.addEventListener("DOMContentLoaded", renderApp);
223}
224
225export default async function server(request: Request): Promise<Response> {
226 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
227 const { email } = await import("https://esm.town/v/std/email");

captivatingPurpleTapirmain.tsx11 matches

@mohsen•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [stocks, setStocks] = useState([]);
7 const [operations, setOperations] = useState([]);
19 }, []);
20
21 async function fetchStocks() {
22 const response = await fetch('/stocks');
23 const data = await response.json();
25 }
26
27 async function fetchOperations() {
28 const response = await fetch('/operations');
29 const data = await response.json();
31 }
32
33 async function addStock(e) {
34 e.preventDefault();
35 const response = await fetch('/stocks', {
43 }
44
45 async function deleteStock(symbol: string, shares: number, purchasePrice: number) {
46 const response = await fetch('/stocks', {
47 method: 'DELETE',
53 }
54
55 async function updateStock(stock) {
56 const response = await fetch('/stocks', {
57 method: 'PUT',
121// Rest of the client-side code remains the same
122
123export default async function server(request: Request): Promise<Response> {
124 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
125 const KEY = "captivatingPurpleTapir";
147 `);
148
149 // Function to log operations
150 async function logOperation(type: string, details: string) {
151 await sqlite.execute(
152 `INSERT INTO ${KEY}_operations_${SCHEMA_VERSION} (type, details) VALUES (?, ?)`,
269}
270
271// Existing fetchStockPrice function remains the same
272async function fetchStockPrice(symbol: string): Promise<number> {
273 try {
274 const response = await fetch(`https://query1.finance.yahoo.com/v8/finance/chart/${symbol}`);

byobmain.tsx1 match

@vawogbemi•Updated 5 months ago
4import { OpenAI } from "https://esm.town/v/std/openai";
5
6export default async function(e: Email) {
7 const client = new OpenAI();
8

byobREADME.md3 matches

@vawogbemi•Updated 5 months ago
1# BYOB - Build Your Own Bot
2
3You can chat with llms over email, the email thread functions as memory. The biggest thing is that you can instantly create a chat
4like interface with llms. Pair that with back end data and functions and you got something really powerful.
5
6## Take it further
11
12### Toolings
13* Llms can uses [tools](https://platform.openai.com/docs/guides/function-calling), meaning you can make this an agent and a whole lot more useful.
14
15

SermonGPTUImain.tsx5 matches

@mjweaver01•Updated 5 months ago
78const endpointURL = "https://mjweaver01-sermongptapi.web.val.run";
79
80function App() {
81 const [question, setQuestion] = useState("");
82 const [response, setResponse] = useState("");
617}
618
619function client() {
620 const root = document.getElementById("root");
621 if (!root) throw new Error("Root element not found");
633}
634
635export default async function server(request: Request): Promise<Response> {
636 const { blob } = await import("https://esm.town/v/std/blob");
637
664}
665
666// Helper function to determine season based on current date
667function getSeason(date: Date): string {
668 const month = date.getMonth();
669 switch (true) {

legendaryVioletBovidmain.tsx9 matches

@stevekrouse•Updated 5 months ago
15 "recipe ingredient converter and scaler",
16 "morse code translator with audio output",
17 "random quote generator with tweet functionality",
18 "personal finance tracker with basic charts",
19 "multiplayer rock-paper-scissors game",
20];
21
22function Dashboard() {
23 const [stats, setStats] = useState<{
24 totalGenerations: number;
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
115}
116
117function App() {
118 const [prompt, setPrompt] = useState(
119 STARTER_PROMPTS[Math.floor(Math.random() * STARTER_PROMPTS.length)],
141 });
142
143 async function handleSubmit(e: React.FormEvent) {
144 e.preventDefault();
145 setLoading(true);
174 }
175
176 function handleVersionChange(direction: "back" | "forward") {
177 const { currentVersionIndex, versions } = versionHistory;
178
305}
306
307function client() {
308 const path = window.location.pathname;
309 const root = createRoot(document.getElementById("root")!);
320}
321
322function extractCodeFromFence(text: string): string {
323 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
324 return htmlMatch ? htmlMatch[1].trim() : text;
325}
326
327export default async function server(req: Request): Promise<Response> {
328 // Dynamic import for SQLite to avoid client-side import
329 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

WhyUseCreativeFabricamain.tsx6 matches

@richi1969•Updated 5 months ago
21];
22
23function HomePage() {
24 return (
25 <div className="page">
81}
82
83function ResourcesPage() {
84 return (
85 <div className="page">
133}
134
135function CommunityPage() {
136 return (
137 <div className="page">
194}
195
196function App() {
197 const [currentPage, setCurrentPage] = useState('home');
198
212}
213
214function client() {
215 createRoot(document.getElementById("root")).render(<App />);
216}
217if (typeof document !== "undefined") { client(); }
218
219export default async function server(request: Request): Promise<Response> {
220 return new Response(`
221 <html>

newThankYouEmailVersionmain.tsx1 match

@stevekrouse•Updated 5 months ago
12});
13
14function getStripeCustomer(customerId: string) {
15 return stripe.customers.retrieve(customerId);
16}

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.