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=1805&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 24880 results for "function"(1769ms)

APIBuilderTemplateblissfulSapphireFly1 match

@dcm31•Updated 3 months ago
1export default function handler(req: Request) {
2 return new Response("Hello, Val Town API!", {
3 headers: {

TestProjectfairYellowSheep1 match

@dcm31•Updated 3 months ago
1function greet() {
2 return "Hello, Val Town!";
3}

aiMessengermain.tsx5 matches

@tesla6940•Updated 3 months ago
3import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5function generateSecureRoomCode() {
6 return crypto.randomUUID().split("-")[0].toUpperCase();
7}
8
9function App() {
10 const [user, setUser] = useState(null);
11 const [chatRooms, setChatRooms] = useState([]);
23
24 useEffect(() => {
25 async function fetchUser() {
26 try {
27 const response = await fetch("/authenticate");
402}
403
404function client() {
405 createRoot(document.getElementById("root")).render(<App />);
406}
407if (typeof document !== "undefined") { client(); }
408
409export default async function server(request: Request): Promise<Response> {
410 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
411 const { OpenAI } = await import("https://esm.town/v/std/openai");

selfassuredCoralPigmain.tsx5 matches

@tesla6940•Updated 3 months ago
3import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5function generateSecureRoomCode() {
6 return crypto.randomUUID().split('-')[0].toUpperCase();
7}
8
9function App() {
10 const [user, setUser] = useState(null);
11 const [chatRooms, setChatRooms] = useState([]);
23
24 useEffect(() => {
25 async function fetchUser() {
26 try {
27 const response = await fetch('/authenticate');
386}
387
388function client() {
389 createRoot(document.getElementById("root")).render(<App />);
390}
391if (typeof document !== "undefined") { client(); }
392
393export default async function server(request: Request): Promise<Response> {
394 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
395 const { OpenAI } = await import("https://esm.town/v/std/openai");

generateQRmain.tsx4 matches

@recklessreticence•Updated 3 months ago
1import { qrcode } from "https://deno.land/x/qrcode/mod.ts";
2
3export default async function server(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5 const peer = url.searchParams.get("peer") || "";
81
82 <script>
83 function showMessage(message) {
84 const notification = document.getElementById("notification");
85 notification.textContent = message;
91 }
92
93 async function copyImage() {
94 try {
95 const dataUrl = document.getElementById("qr-img").src;
137 }
138
139 function copyBase64() {
140 const base64Text = document.getElementById("qr-base64").innerText;
141 navigator.clipboard.writeText(base64Text)

filemain.tsx5 matches

@recklessreticence•Updated 3 months ago
22}
23
24function getFileEmote(file: RTCFile) {
25 const fileType = file.type.split("/")[0];
26 switch (fileType) {
59const buttonHover = Object.values(ButtonHover)[randomIndex];
60
61function App() {
62 const [showModal, setShowModal] = useState(false);
63 const [peerId, setPeerId] = useState("");
154 * @returns The base64 string if found; otherwise, null.
155 */
156 function extractBase64FromHtml(html: string): string | null {
157 // This regex captures everything between <pre id="qr-base64"> and </pre>
158 const regex = /<pre\s+id=["']qr-base64["']>([\s\S]*?)<\/pre>/i;
393}
394
395function client() {
396 render(<App />, document.getElementById("root")!);
397}
432`;
433
434export default async function server(request: Request): Promise<Response> {
435 const url = new URL(request.url);
436

blob_admin_migratedmain.tsx8 matches

@shouser•Updated 3 months ago
13}
14
15function Tooltip({ children, content }: TooltipProps) {
16 const [isVisible, setIsVisible] = useState(false);
17 const tooltipRef = useRef<HTMLDivElement>(null);
52}
53
54function formatBytes(bytes: number, decimals = 2) {
55 if (bytes === 0) return "0 Bytes";
56 const k = 1024;
61}
62
63function copyToClipboard(text: string) {
64 navigator.clipboard.writeText(text).then(() => {
65 console.log("Text copied to clipboard");
69}
70
71function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72 const [isOpen, setIsOpen] = useState(false);
73 const menuRef = useRef(null);
76
77 useEffect(() => {
78 function handleClickOutside(event) {
79 if (menuRef.current && !menuRef.current.contains(event.target)) {
80 event.stopPropagation();
158}
159
160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161 const [isLoading, setIsLoading] = useState(false);
162 const decodedKey = decodeURIComponent(blob.key);
219}
220
221function App({ initialEmail, initialProfile }) {
222 const encodeKey = (key: string) => encodeURIComponent(key);
223 const decodeKey = (key: string) => decodeURIComponent(key);
645}
646
647function client() {
648 const initialEmail = document.getElementById("root").getAttribute("data-email");
649 const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));

sqliteExplorerAppREADME.md1 match

@shouser•Updated 3 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

versatileWhiteJaymain.tsx3 matches

@Love•Updated 3 months ago
24];
25
26function IndianMovieExplorer() {
27 const [searchTerm, setSearchTerm] = useState("");
28 const [actors, setActors] = useState([]);
311}
312
313function client() {
314 createRoot(document.getElementById("root")).render(<IndianMovieExplorer />);
315}
317if (typeof document !== "undefined") { client(); }
318
319export default async function server(request: Request) {
320 return new Response(`
321 <html>

CRMmain.tsx6 matches

@juecd•Updated 3 months ago
3import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5function LoginScreen({ onLogin }) {
6 const [password, setPassword] = useState("");
7 const [error, setError] = useState("");
46}
47
48function CustomerInteractionForm({ onSubmit }) {
49 const [email, setEmail] = useState("");
50 const [firstName, setFirstName] = useState("");
240}
241
242function InteractionList() {
243 const [customerInteractions, setCustomerInteractions] = useState({});
244 const [copiedEmail, setCopiedEmail] = useState(null);
470}
471
472function App() {
473 const [isAuthenticated, setIsAuthenticated] = useState(false);
474 const [refreshList, setRefreshList] = useState(0);
517}
518
519function client() {
520 createRoot(document.getElementById("root")).render(<App />);
521}
522if (typeof document !== "undefined") { client(); }
523
524export default async function server(request: Request): Promise<Response> {
525 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
526 const KEY = "CRM";

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.