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/$%7Bart_info.art.src%7D?q=function&page=1534&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 20531 results for "function"(3892ms)

cerebras_codermain.tsx5 matches

@franklycUpdated 6 months ago
6import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
7
8function App() {
9 const [prompt, setPrompt] = useState("hello llamapalooza");
10 const [code, setCode] = useState("");
18 >(null);
19
20 async function handleSubmit(e: React.FormEvent) {
21 e.preventDefault();
22 setLoading(true);
97}
98
99function client() {
100 createRoot(document.getElementById("root")!).render(<App />);
101}
105}
106
107function extractCodeFromFence(text: string): string {
108 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
109 return htmlMatch ? htmlMatch[1].trim() : text;
110}
111
112export default async function server(req: Request): Promise<Response> {
113 if (req.method === "POST") {
114 const client = new Cerebras();

effortlessAquamarineHookwormmain.tsx8 matches

@nsafouaneUpdated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function ThemeToggle({ isDarkMode, toggleTheme }) {
6 return (
7 <div className="theme-toggle-container">
21}
22
23function BlogPost({ title, content, timestamp, author, preview = false }) {
24 const truncatedContent = preview
25 ? content.length > 200
49}
50
51function Navigation({ currentPage, setCurrentPage, isDarkMode, toggleTheme }) {
52 return (
53 <nav className="main-nav">
71}
72
73function HomePage({ posts, currentPage, setCurrentPage, totalPages }) {
74 return (
75 <div className="home-page">
110}
111
112function Dashboard({ postCount, totalViews, posts, fetchDashboardStats }) {
113 const [title, setTitle] = useState("");
114 const [content, setContent] = useState("");
257}
258
259function BlogApp() {
260 const [posts, setPosts] = useState([]);
261 const [dashboard, setDashboard] = useState({ postCount: 0, totalViews: 0 });
341}
342
343function client() {
344 createRoot(document.getElementById("root")).render(<BlogApp />);
345}
346if (typeof document !== "undefined") { client(); }
347
348export default async function server(request: Request): Promise<Response> {
349 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
350 const KEY = "effortlessAquamarineHookworm";

multilingualchatroommain.tsx9 matches

@lloydpearsonivUpdated 6 months ago
93};
94
95function Banner({ message, isVisible, language }) {
96 if (!isVisible) return null;
97 return <div className="banner">{message[language] || message.en}</div>;
98}
99
100function UserList({ users, t }) {
101 return (
102 <div className="user-list">
113}
114
115function Sidebar({ users, language, handleLanguageChange, roomUrl, copyToClipboard, copied, t }) {
116 return (
117 <div className="sidebar">
149}
150
151function TypingIndicator({ typingUsers, t }) {
152 if (typingUsers.length === 0) return null;
153
164}
165
166function App() {
167 const [messages, setMessages] = useState([]);
168 const [inputMessage, setInputMessage] = useState("");
490}
491
492function client() {
493 createRoot(document.getElementById("root")).render(<App />);
494}
495if (typeof document !== "undefined") { client(); }
496
497export default async function server(request: Request): Promise<Response> {
498 const url = new URL(request.url);
499 const { blob } = await import("https://esm.town/v/std/blob");
508 const TIME_WINDOW = 60 * 1000; // 1 minute
509
510 async function checkRateLimit() {
511 const now = Date.now();
512 const rateLimit = await blob.getJSON(RATE_LIMIT_KEY) || { count: 0, timestamp: now };
523 }
524
525 async function translateText(text: string, targetLanguage: string, sourceLanguage: string): Promise<string> {
526 const cacheKey = `${KEY}_translation_${sourceLanguage}_${targetLanguage}_${text}`;
527 const cachedTranslation = await blob.getJSON(cacheKey);

scraper_templateREADME.md1 match

@lloydpearsonivUpdated 6 months ago
133. Adjust the if statement to detect changes and update your blob
14
154. Craft a message to be sent with `sendNotification()` function

expositionAgencyPagemain.tsx3 matches

@bladesquadUpdated 6 months ago
54}
55
56function ExpolineParticipationForm() {
57 const [step, setStep] = useState(0);
58 const [formData, setFormData] = useState({
310}
311
312function client() {
313 createRoot(document.getElementById("root")).render(<ExpolineParticipationForm />);
314}
491`;
492
493export default async function server(request: Request): Promise<Response> {
494 return new Response(`
495 <html>

blueskymain.tsx1 match

@pomdtrUpdated 6 months ago
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {

Send_Errors_to_Emailmain.tsx1 match

@bmitchinsonUpdated 6 months ago
1import { email } from "https://esm.town/v/std/email";
2
3export default async function server(request: Request): Promise<Response> {
4 // Retrieve secret from environment variables
5 const SECRET_KEY = Deno.env.get("ERROR_REPORT_SECRET");

pjsSearchUImain.tsx4 matches

@gUpdated 6 months ago
7import { Hono } from 'npm:hono';
8
9function html() {
10 /*
11<!DOCTYPE html>
45}
46
47function css() {
48 /*
49:root {
169}
170
171function js() {
172 /*
173const searchInput = document.querySelector('.search-input');
188}
189
190function favicon() {
191 /*
192<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">

sweetBonanzaGamemain.tsx3 matches

@aa370166fasdUpdated 6 months ago
12];
13
14function SlotMachine() {
15 const [slots, setSlots] = useState(Array(5).fill(Array(4).fill("❓")));
16 const [balance, setBalance] = useState(1000);
158}
159
160function client() {
161 createRoot(document.getElementById("root")).render(<SlotMachine />);
162}
164if (typeof document !== "undefined") { client(); }
165
166export default async function server(request: Request) {
167 return new Response(`
168 <html>

HermesTresmegistusmain.tsx11 matches

@jidunUpdated 6 months ago
153 const typingIndicator = document.querySelector('.typing-indicator');
154
155 function addMessage(content, type) {
156 const messageElement = document.createElement('div');
157 messageElement.classList.add('message', type);
161 }
162
163 function loadChatHistories() {
164 try {
165 const savedChatsRaw = localStorage.getItem('chatHistories');
167
168 chatHistorySelect.innerHTML = '';
169 savedChats.forEach(function(chat, index) {
170 const option = document.createElement('option');
171 option.value = index;
178 }
179
180 function saveChat() {
181 try {
182 const chatName = prompt('Enter a name for this chat history:') || ('Chat ' + Date.now());
183 const messages = Array.from(chatMessages.children).map(function(msg) {
184 return {
185 content: msg.textContent,
200 }
201
202 function loadSelectedChat() {
203 try {
204 const selectedIndex = chatHistorySelect.value;
211 if (selectedChat) {
212 chatMessages.innerHTML = '';
213 selectedChat.messages.forEach(function(msg) {
214 addMessage(msg.content, msg.type === 'user' ? 'user-message' : 'ai-message');
215 });
221 }
222
223 function deleteSelectedChat() {
224 try {
225 const selectedIndex = chatHistorySelect.value;
239 }
240
241 async function sendMessage() {
242 const message = messageInput.value.trim();
243 if (!message) return;
270 loadButton.addEventListener('click', loadSelectedChat);
271 deleteButton.addEventListener('click', deleteSelectedChat);
272 messageInput.addEventListener('keypress', function(e) {
273 if (e.key === 'Enter') sendMessage();
274 });
308 } catch (error) {
309 console.error("OpenAI error:", error);
310 return c.json({ response: "Neural networks malfunctioning. Try again, human." });
311 }
312});

getFileEmail4 file matches

@shouserUpdated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 3 weeks 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.