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%22Image%20title%22?q=function&page=2307&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 28575 results for "function"(3623ms)

newThankYouEmailVersionmain.tsx1 match

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

notionSiteRssmain.tsx4 matches

@bao•Updated 5 months ago
1import { Client } from "https://esm.sh/@notionhq/client";
2
3export default async function server(request: Request): Promise<Response> {
4 // Retrieve Notion API token from environment variable
5 const notionToken = Deno.env.get("NOTION_API_TOKEN");
53}
54
55function generateRSSFeed(pages: any[], databaseMetadata: any): string {
56 // Get database title from database metadata
57 const databaseTitle = databaseMetadata.title[0]?.text.content
103}
104
105function escapeXml(unsafe: string): string {
106 return unsafe.replace(/[<>&'"]/g, function(c) {
107 switch (c) {
108 case "<":

bandcampWrappedScriptmain.tsx3 matches

@donmccurdy•Updated 5 months ago
14]
15
16function esc(string) {
17 return replacements.reduce(function(string, replacement) {
18 return string.replace(replacement[0], replacement[1])
19 }, string)
71 )
72
73 function c(tag, style) {
74 const elem = document.createElement(tag)
75 if (style) elem.style = style

tweetArchiveViewermain.tsx10 matches

@nulo•Updated 5 months ago
17const COBALT_API_URL = "https://dorsiblancoapicobalt.nulo.in";
18
19async function fetchMedia(url) {
20 try {
21 const response = await fetch(COBALT_API_URL, {
58}
59
60async function fetchTweets(dumpFile) {
61 try {
62 const response = await fetch(BASE_URL + dumpFile);
96}
97
98function extractMediaUrls(tweet) {
99 const mediaUrls = [];
100 if (tweet.__raw_UNSTABLE && tweet.__raw_UNSTABLE.extended_entities && tweet.__raw_UNSTABLE.extended_entities.media) {
113}
114
115function formatDate(dateString) {
116 const date = new Date(dateString);
117 return date.toLocaleString("es-AR", {
125}
126
127function Tweet({ tweet, onMediaLoad }) {
128 const formattedDate = formatDate(tweet.timeParsed);
129 const [mediaContent, setMediaContent] = useState([]);
131
132 useEffect(() => {
133 async function loadMedia() {
134 const media = await Promise.all(tweet.mediaUrls.map(async (media) => {
135 if (media.type === "video") {
188}
189
190function App() {
191 const [tweets, setTweets] = useState([]);
192 const [filteredTweets, setFilteredTweets] = useState([]);
230 }, [searchQuery, tweets]);
231
232 async function loadTweets() {
233 if (isLoading) return;
234 setIsLoading(true);
364}
365
366function client() {
367 createRoot(document.getElementById("root")).render(<App />);
368}
372}
373
374export default async function server(request: Request): Promise<Response> {
375 return new Response(
376 `

heroicEmeraldWoodpeckermain.tsx2 matches

@stevekrouse•Updated 5 months ago
8 .join(" OR ") + " " + excludes;
9
10function relevant(t: Tweet) {
11 if (keywords.some(k => t.full_text?.includes(k))) return true;
12 return t.entities.urls?.some(u => keywords.some(k => u.expanded_url?.includes(k)));
17const isProd = true;
18
19export async function twitterAlert({ lastRunAt }: Interval) {
20 // search
21 const since = isProd

valreadmegeneratormain.tsx4 matches

@prashamtrivedi•Updated 5 months ago
4import React, { useRef, useState, useEffect } from "https://esm.sh/react@18.2.0";
5
6function App() {
7 const [username, setUsername] = useState("");
8 const [valName, setValName] = useState("");
158}
159
160function client() {
161 createRoot(document.getElementById("root")).render(<App />);
162}
163if (typeof document !== "undefined") { client(); }
164
165export default async function server(request: Request): Promise<Response> {
166 const url = new URL(request.url);
167 const parts = url.pathname.split('/').filter(Boolean);
248 });
249 } catch (error) {
250 console.error('Error in server function:', error);
251 return new Response(`Error: ${error.message}`, { status: 500 });
252 }

personalSocialCardGeneratormain.tsx5 matches

@mumu•Updated 5 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [cardData, setCardData] = useState(null);
8
41}
42
43function PersonalCard({ data }) {
44 return (
45 <div className="bg-white rounded-xl shadow-2xl max-w-md w-full overflow-hidden">
115}
116
117function getBackgroundColor(index) {
118 const colors = ["bg-blue-100", "bg-green-100", "bg-purple-100", "bg-orange-100"];
119 return colors[index % colors.length];
120}
121
122function client() {
123 createRoot(document.getElementById("root")).render(<App />);
124}
128}
129
130async function server(request: Request): Promise<Response> {
131 if (request.method === "POST" && new URL(request.url).pathname === "/generate") {
132 const formData = await request.formData();

cerebras_codermain.tsx10 matches

@adnane007al•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();
97}
98
99function App() {
100 const [prompt, setPrompt] = useState(
101 STARTER_PROMPTS[Math.floor(Math.random() * STARTER_PROMPTS.length)],
128
129 useEffect(() => {
130 async function fetchUsageStats() {
131 const response = await fetch("/usage-stats");
132 const data = await response.json();
136 }, []);
137
138 async function handleSubmit(e: React.FormEvent) {
139 e.preventDefault();
140 setLoading(true);
170 }
171
172 function handleVersionChange(direction: "back" | "forward") {
173 const { currentVersionIndex, versions } = versionHistory;
174
271}
272
273function client() {
274 const path = window.location.pathname;
275 const root = createRoot(document.getElementById("root")!);
286}
287
288function extractCodeFromFence(text: string): string {
289 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
290 return htmlMatch ? htmlMatch[1].trim() : text;
291}
292
293export default async function server(req: Request): Promise<Response> {
294 // Dynamic import for SQLite to avoid client-side import
295 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

blueskyAlertmain.tsx1 match

@eseidel•Updated 5 months ago
10});
11
12async function search(q: string, lastRunAt: Date | undefined) {
13 const res = await agent.app.bsky.feed.searchPosts({
14 q,

icsviewermain.tsx6 matches

@prashamtrivedi•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function generateRandomColor() {
6 const hue = Math.floor(Math.random() * 360);
7 return `hsl(${hue}, 70%, 50%)`;
8}
9
10function parseICSDate(dateString: string): Date {
11 if (!dateString) return new Date();
12
36}
37
38function parseICSContent(content: string) {
39 try {
40 console.log("Parsing ICS content:", content);
75}
76
77function Calendar() {
78 const [events, setEvents] = useState([
79 {
309}
310
311function client() {
312 createRoot(document.getElementById("root")).render(<Calendar />);
313}
315if (typeof document !== "undefined") { client(); }
316
317export default async function server(request: Request): Promise<Response> {
318 return new Response(`
319 <html>

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.