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=2452&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 28333 results for "function"(2129ms)

pgliteNpmmain.tsx1 match

@maxm•Updated 9 months ago
15 `);
16
17export default async function(req: Request): Promise<Response> {
18 await db.query(`
19 UPDATE test

isMyWebsiteDownmain.tsx1 match

@pj0•Updated 9 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;

CIDGenerationmain.tsx2 matches

@stevedylandev•Updated 9 months ago
31};
32
33async function main() {
34 try {
35 const jsonData = {
46}
47
48async function pinFileToIPFS() {
49 try {
50 const jsonData = {

esmmain.tsx1 match

@pomdtr•Updated 9 months ago
2import { parseAuthorizationHeader } from "https://esm.town/v/pomdtr/parseAuthorizationHeader";
3
4export default async function(req: Request) {
5 const url = new URL(req.url);
6 const parts = url.pathname.slice(1).split("/");

csvViewermain.tsx9 matches

@g•Updated 9 months ago
1/**
2 * This application creates a CSV viewer using a Hono app that serves a client-side application.
3 * It allows users to upload a CSV file, view its contents in a table format, and provides basic sorting functionality.
4 *
5 * The approach:
6 * 1. Create a server-side Hono app to handle file uploads and serve the HTML, CSS, and JavaScript.
7 * 2. Implement client-side JavaScript to handle file reading, parsing CSV, and displaying the data in a table.
8 * 3. Add sorting functionality to allow users to sort the table by clicking on column headers.
9 *
10 * Libraries used:
16import { Hono } from 'npm:hono';
17
18function html() {
19 /*
20<!DOCTYPE html>
38}
39
40function css() {
41 /*
42body {
99}
100
101function js() {
102 /*
103import Papa from 'https://esm.sh/papaparse@5.4.1';
111fileInput.addEventListener('change', handleFileUpload);
112
113function handleFileUpload(event) {
114 const file = event.target.files[0];
115 if (file) {
116 Papa.parse(file, {
117 complete: function(results) {
118 currentData = results.data;
119 currentHeaders = currentData[0];
124}
125
126function displayTable(data) {
127 if (data.length === 0) return;
128
152}
153
154function sortTable(column) {
155 const columnIndex = currentHeaders.indexOf(column);
156 if (columnIndex === -1) return;

townieTemplateAppmain.tsx3 matches

@g•Updated 9 months ago
2import { Hono } from 'npm:hono';
3
4function html() {
5 /*
6<!DOCTYPE html>
20}
21
22function css() {
23 /*
24body {
34}
35
36function js() {
37 /*
38import df from 'https://esm.sh/dateformat';

statusmain.tsx3 matches

@rareadmin•Updated 9 months ago
5import { renderToString } from "npm:react-dom/server";
6
7function StatusRow({ rows }) {
8 return (
9 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

viem_auto_load_abimain.tsx1 match

@git•Updated 9 months ago
13 abi,
14 address,
15 functionName: "information",
16});
17

fluxImageGeneratormain.tsx7 matches

@isidentical•Updated 9 months ago
26}
27
28function LightningBolt({ x, y }) {
29 return (
30 <svg x={x} y={y} width="40" height="40" viewBox="0 0 10 10">
34}
35
36function Background() {
37 const [bolts, setBolts] = useState([]);
38
62}
63
64function LoadingSpinner() {
65 return (
66 <div className="loading-spinner">
70}
71
72function App() {
73 const [prompt, setPrompt] = useState(DEFAULT_PROMPT);
74 const [imageUrl, setImageUrl] = useState(PLACEHOLDER_IMAGE);
147}
148
149function client() {
150 createRoot(document.getElementById("root")).render(<App />);
151}
155}
156
157async function checkRateLimit(clientIP: string): Promise<boolean> {
158 const now = Date.now();
159 const key = `xratelimit_${clientIP}`;
177}
178
179async function server(request: Request): Promise<Response> {
180 if (request.method === "POST" && new URL(request.url).pathname === "/generate") {
181 const clientIP = (request.headers.get("x-forwarded-for") || "unknown").split(",")[0].trim();

bigFuchsiaHalibutmain.tsx8 matches

@breeze4•Updated 9 months ago
2 * This React app creates a search interface with a navbar and two equal-width panels.
3 * It includes a search input on the left and displays search results as cards on the right.
4 * The search functionality is simulated with a static list of items.
5 */
6
18];
19
20function Navbar() {
21 return (
22 <nav style={styles.navbar}>
26}
27
28function SearchBar({ onSearch }) {
29 const [query, setQuery] = useState("");
30
48}
49
50function SearchResultCard({ item }) {
51 return (
52 <div style={styles.card}>
68}
69
70function SearchResults({ results }) {
71 return (
72 <div style={styles.resultsPanel}>
79}
80
81function App() {
82 const [searchResults, setSearchResults] = useState([]);
83
188};
189
190function client() {
191 createRoot(document.getElementById("root")).render(<App />);
192}
194if (typeof document !== "undefined") { client(); }
195
196async function server(request: Request): Promise<Response> {
197 return new Response(`
198 <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.