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=2402&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 29557 results for "function"(1777ms)

cerebras_codermain.tsx9 matches

@nickstefen•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");

FetchBasicmain.tsx1 match

@thesagrotan•Updated 5 months ago
1export default async function(req: Request): Promise<Response> {
2 // Pick a random greeting
3 const greetings = ["Hello!", "Welcome!", "Hi!", "Heya!", "Hoi!"];

gregariousCrimsonFlamingomain.tsx9 matches

@Saadaap•Updated 5 months ago
13const FONT_FAMILY = 'CIRO, Arial, sans-serif';
14
15function MainHeader() {
16 const [dropdownOpen, setDropdownOpen] = useState(false);
17
77}
78
79function MorePage() {
80 const navigate = useNavigate();
81
208}
209
210function App() {
211 return (
212 <BrowserRouter>
231}
232
233function BottomNavbar() {
234 const navigate = useNavigate();
235
272}
273
274function MainPage() {
275 const navigate = useNavigate();
276
337}
338
339function ServicesPage() {
340 const navigate = useNavigate();
341 const [searchTerm, setSearchTerm] = useState('');
460}
461
462function ReportsPage() {
463 const navigate = useNavigate();
464 const [selectedReport, setSelectedReport] = useState(null);
581}
582
583function client() {
584 createRoot(document.getElementById("root")).render(<App />);
585}
587if (typeof document !== "undefined") { client(); }
588
589export default async function server(request: Request): Promise<Response> {
590 return new Response(`
591 <html>

rijksmain.tsx7 matches

@sammeltassen•Updated 5 months ago
5const resolverBase = "https://id.rijksmuseum.nl/";
6
7function createManifest(images: any[], label: any, metadata: any, id: string) {
8 const builder = new IIIFBuilder();
9 const uri = "https://sammeltassen-rijks.web.val.run/" + id;
50}
51
52function getImageInformation(record: any) {
53 const imageApiEndpoint = record?.["rdf:RDF"]?.["svcs:Service"]?.[0]?.$?.["rdf:about"];
54 if (imageApiEndpoint) {
59}
60
61function getMoreImages(part: any) {
62 const uri = part.$["rdf:resource"];
63 const id = uri.split("/").pop();
67}
68
69function getValues(property: any) {
70 if (property && property.length) {
71 const obj: any = new Object();
83}
84
85function getMetadata(props: any) {
86 const title = getValues(props["dc:title"]);
87 const identifier = getValues(props["dc:identifier"]);
142}
143
144async function fetchJson(id: string) {
145 const headers = new Headers([
146 ["Accept-Profile", "edm"],
155}
156
157export default async function(req: Request): Promise<Response> {
158 const url = new URL(req.url);
159 const params = url.searchParams;

widemain.tsx1 match

@vawogbemi•Updated 5 months ago
74}
75
76export default async function(req: Request): Promise<Response> {
77 // Use your Val Town API Token to create a session
78 const wide = new Wide(await ValSession.new(Deno.env.get("valtown")));

inspiringLavenderTakinmain.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");

slackScoutmain.tsx10 matches

@kamath•Updated 5 months ago
15}
16
17export default async function(interval: Interval): Promise<void> {
18 try {
19 await createTable();
38
39// Create an SQLite table
40async function createTable(): Promise<void> {
41 await sqlite.execute(`
42 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
50
51// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53 return hackerNewsSearch({
54 query: topic,
58}
59
60async function fetchTwitterResults(topic: string): Promise<Website[]> {
61 return twitterSearch({
62 query: topic,
67}
68
69async function fetchRedditResults(topic: string): Promise<Website[]> {
70 return redditSearch({ query: topic });
71}
72
73function formatSlackMessage(website: Website): string {
74 const displayTitle = website.title || website.url;
75 return `*<${website.url}|${displayTitle}>*
78}
79
80async function sendSlackMessage(message: string): Promise<Response> {
81 const slackWebhookUrl = Deno.env.get("SLACK_WEBHOOK_URL");
82 if (!slackWebhookUrl) {
104}
105
106async function isURLInTable(url: string): Promise<boolean> {
107 const result = await sqlite.execute({
108 sql: `SELECT 1 FROM ${TABLE_NAME} WHERE url = :url LIMIT 1`,
112}
113
114async function addWebsiteToTable(website: Website): Promise<void> {
115 await sqlite.execute({
116 sql: `INSERT INTO ${TABLE_NAME} (source, url, title, date_published)
120}
121
122async function processResults(results: Website[]): Promise<void> {
123 for (const website of results) {
124 if (!(await isURLInTable(website.url))) {

projectTweetGallerymain.tsx5 matches

@manyone•Updated 5 months ago
22];
23
24function TweetEmbed({ tweetId }) {
25 const containerRef = useRef(null);
26
54}
55
56function TweetGallery() {
57 return (
58 <div className="tweet-gallery">
62}
63
64function App() {
65 return (
66 <div className="dark-mode">
78}
79
80function client() {
81 createRoot(document.getElementById("root")).render(<App />);
82}
83if (typeof document !== "undefined") { client(); }
84
85export default async function server(request: Request): Promise<Response> {
86 return new Response(
87 `

interview_practicemain.tsx3 matches

@spinningideas•Updated 5 months ago
14}
15
16function App() {
17 const [intervieweeResponse, setIntervieweeResponse] = useState("");
18 const [response, setResponse] = useState("");
225}
226
227function client() {
228 createRoot(document.getElementById("root")).render(<App />);
229}
230if (typeof document !== "undefined") { client(); }
231
232export default async function server(request: Request): Promise<Response> {
233 if (request.method === "POST" && new URL(request.url).pathname === "/ask") {
234 try {

webpage_summarizermain.tsx3 matches

@spinningideas•Updated 5 months ago
5import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
6
7function App() {
8 const [url, setUrl] = useState(() => {
9 // Initialize URL from localStorage on first load
214}
215
216function client() {
217 createRoot(document.getElementById("root")).render(<App />);
218}
219if (typeof document !== "undefined") { client(); }
220
221export default async function server(request: Request): Promise<Response> {
222 if (request.method === "POST" && new URL(request.url).pathname === "/summarize") {
223 try {
tuna

tuna9 file matches

@jxnblk•Updated 3 days ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.