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=2409&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 28757 results for "function"(7711ms)

singlePageUrlCheckermain.tsx4 matches

@willthereader•Updated 7 months ago
248}
249
250// Main Function
251export async function findBrokenLinks(websiteUrl) {
252 try {
253 console.log(`Starting findBrokenLinks for website: ${websiteUrl}`);
273
274// HTTP request handler
275export default async function(req: Request): Promise<Response> {
276 const url = new URL(req.url).searchParams.get("url") || "https://willkrouse.com/projects";
277 console.log(`Starting broken link check at ${new Date().toISOString()}`);
299 });
300 } catch (error) {
301 console.error(`Error in main function: ${error.message}`);
302 return new Response(JSON.stringify({ error: error.message }), {
303 status: 500,

valcoinmain.tsx1 match

@aggy•Updated 7 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) {

valcoinDashboardmain.tsx7 matches

@aggy•Updated 7 months ago
5const API_URL = "https://aggy-valcoinapi.web.val.run";
6
7function App() {
8 const [wallets, setWallets] = useState([]);
9 const [sourceKey, setSourceKey] = useState("");
17 }, []);
18
19 async function fetchWallets() {
20 try {
21 const response = await fetch(`${API_URL}/wallets`);
29 }
30
31 async function createWallet() {
32 try {
33 const response = await fetch(`${API_URL}/create-wallet`, { method: "POST" });
48 }
49
50 async function transferValCoin() {
51 // Input validation
52 if (!sourceKey || !destinationHash || !amount) {
98 }
99
100 function FeedbackMessage({ message, type }) {
101 const bgColor = type === "success" ? "bg-green-100 border-green-400 text-green-700" : "bg-red-100 border-red-400 text-red-700";
102 return (
183}
184
185function renderApp() {
186 const appHtml = renderToString(<App />);
187 return `
207}
208
209export default async function(req: Request): Promise<Response> {
210 return new Response(renderApp(), {
211 headers: { "Content-Type": "text/html" },

countGithubLOCUImain.tsx9 matches

@g•Updated 7 months ago
2 * This val creates a website to count lines of code in GitHub repositories.
3 * It uses a server-side API to fetch the data and a client-side UI for user interaction.
4 * It now includes sharing functionality and URL manipulation for better user experience.
5 */
6import countGithubLOC from 'https://esm.town/v/g/countGithubLOC';
10import { getEndpointUrl } from "https://esm.town/v/g/getEndpointUrl";
11
12function html() {
13 /*
14<!DOCTYPE html>
62}
63
64function css() {
65 /*
66body {
156}
157
158function js() {
159 /*
160const form = document.getElementById('repoForm');
167const shareButton = document.getElementById('shareButton');
168
169function parseQueryParams() {
170 const urlParams = new URLSearchParams(window.location.search);
171 const user = urlParams.get('user');
179}
180
181async function countLines(user, repo) {
182 resultDiv.classList.add('hidden');
183 errorDiv.classList.add('hidden');
219});
220
221function parseGitHubUrl(url) {
222 try {
223 const parsedUrl = new URL(url);
232}
233
234function handlePaste(e) {
235 const pastedText = (e.clipboardData || window.clipboardData).getData('text');
236 const parsedRepo = parseGitHubUrl(pastedText);
252}
253
254function shareTemplate(user: string, repo: string) {
255 const endpoint = getEndpointUrl(import.meta.url);
256 const url = new URL(`/gh/${encodeURIComponent(user)}/${encodeURIComponent(repo)}`, endpoint);

countGithubLOCmain.tsx2 matches

@g•Updated 7 months ago
1import { Unzip, UnzipInflate, strFromU8 } from 'https://esm.sh/fflate';
2
3export default function countGithubLOC(username: string, repoName: string) {
4 return new Promise((resolve, reject) => {
5 const repo = `${username}/${repoName}`;
25
26 const reader = res.body.getReader();
27 function onread({ done, value }: ReadableStreamReadResult<Uint8Array>) {
28 unzip.push(done ? new Uint8Array(0) : value, done);
29 if(!done) reader.read().then(onread).catch(reject);

multilingualchatroommain.tsx9 matches

@ireneg•Updated 7 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);

solanaPayDemomain.tsx3 matches

@vawogbemi•Updated 7 months ago
19import { createRoot } from "https://esm.sh/react-dom/client";
20
21function Home() {
22 const [storeName, setStoreName] = useState("");
23 const [description, setDescription] = useState("");
238}
239
240function client() {
241 createRoot(document.getElementById("root")).render(<Home />);
242}
243if (typeof document !== "undefined") { client(); }
244
245export default async function server(request: Request): Promise<Response> {
246 return new Response(
247 `

Update_Wise_Old_Manmain.tsx1 match

@evanrh•Updated 7 months ago
1import { WOMClient } from "npm:@wise-old-man/utils";
2
3export default async function(interval: Interval) {
4 const rawUsers = Deno.env.get("OSRS_USERS") ?? "";
5 const users: string[] = rawUsers.split(",");

countGithubLOCStreamingConceptmain.tsx2 matches

@g•Updated 7 months ago
23}
24
25function onfile(file: UnzipFile) {
26 const { name } = file;
27 file.ondata = (err, data, final) => {
37}
38
39function ondone() {
40 console.log(`${repo}: Found ${loc} lines of code.`);
41}

multilingualchatroommain.tsx9 matches

@trob•Updated 7 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);

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.