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?q=function&page=2856&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 35210 results for "function"(8005ms)

react_client_forkmain.tsx3 matches

@charmaine•Updated 5 months ago
4import { blob } from "https://esm.town/v/std/blob?v=10";
5
6function App({ initialTodos }: { initialTodos: { text: string; }[]; }) {
7 const [todos, setTodos] = useState<{ text: string; }[]>(Array.isArray(initialTodos) ? initialTodos : []);
8 const [newTodo, setNewTodo] = useState("");
109}
110
111function client() {
112 const fetchTodos = async () => {
113 const response = await fetch('/todos');
123if (typeof document !== "undefined") { client(); }
124
125export default async function server(request: Request) {
126 if (request.method === 'POST' && request.url.endsWith('/add-todo')) {
127 const body = await request.json();

sitesUptimeMonitormain.tsx2 matches

@przeprogramowani•Updated 5 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;
40}
41
42export default async function(interval: Interval) {
43 ["https://opanujfrontend.pl", "https://opanujtypescript.pl", "https://opanuj.ai", "https://przeprogramowani.pl"]
44 .forEach(uptimeCheck);

tenderAmethystScallopmain.tsx3 matches

@shubham02•Updated 5 months ago
4import { jsPDF } from "https://esm.sh/jspdf@2.5.1";
5
6function ImageToPDFConverter() {
7 const [size, setSize] = useState('A4');
8 const [customWidth, setCustomWidth] = useState('');
115}
116
117export default function handler(req: Request) {
118 const html = renderToString(
119 <html lang="en">
148}
149
150function client() {
151 const root = document.getElementById('root');
152 if (root) {

imagetopdfmain.tsx3 matches

@shubham02•Updated 5 months ago
4import { jsPDF } from "https://esm.sh/jspdf@2.5.1";
5
6function ImageToPDFConverter() {
7 const [size, setSize] = useState('A4');
8 const [customWidth, setCustomWidth] = useState('');
115}
116
117export default function handler(req: Request) {
118 const html = renderToString(
119 <html lang="en">
148}
149
150function client() {
151 const root = document.getElementById('root');
152 if (root) {

weatherBasedActivityAlertingmain.tsx6 matches

@mattwd7•Updated 5 months ago
25///////////////////////
26
27// Helper function to get day of week
28function getDayOfWeek(dateString: string): string {
29 const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
30 return days[new Date(dateString).getDay()];
31}
32
33// Helper function to format date as MM/DD
34function formatDate(dateString: string): string {
35 const date = new Date(dateString);
36 return `${date.getMonth() + 1}/${date.getDate()}`;
38
39// Dynamically extract unique metrics from activities
40function extractUniqueMetrics(activityDefinitions: typeof activities): string[] {
41 const metricsSet = new Set<string>();
42 Object.values(activityDefinitions).forEach(activity => {
46}
47
48export default async function() {
49 try {
50 // Dynamically generate metrics list

blob_adminmain.tsx8 matches

@yeiko•Updated 5 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"));

valTownInspoListmain.tsx1 match

@rodrigotello•Updated 5 months ago
119}, {
120 "title": "Generate PDFs",
121 "description": "Generate PDFs using val functions by using an external library like jsPDF",
122 "val": "@vtdocs.examplePDF",
123 image:

reMarkableXNYTCrosswordmain.tsx2 matches

@rensaketh•Updated 5 months ago
3import request from "npm:request";
4
5export default async function(interval: Interval) {
6 // Cookies and Tokens -> use `mitmweb` to navigate to NYTimes.com to grab cookie. Repeat for my.remarkable.com
7
63 },
64 })
65 .then(function(response) {
66 var rmMetadata = { "parent": rmFolderGuid, "file_name": puzzleFriendlyName };
67

randomVideoChatAppmain.tsx4 matches

@ghouri•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function RandomVideoChat() {
6 const [connectionStatus, setConnectionStatus] = useState("Disconnected");
7 const [isSearching, setIsSearching] = useState(false);
167}
168
169function App() {
170 return <RandomVideoChat />;
171}
172
173function client() {
174 createRoot(document.getElementById("root")).render(<App />);
175}
176if (typeof document !== "undefined") { client(); }
177
178export default async function server(request: Request): Promise<Response> {
179 return new Response(`
180 <html>

valTownInspoListmain.tsx1 match

@charmaine•Updated 5 months ago
119}, {
120 "title": "Generate PDFs",
121 "description": "Generate PDFs using val functions by using an external library like jsPDF",
122 "val": "@vtdocs.examplePDF",
123 image:

discordWebhook2 file matches

@stevekrouse•Updated 3 weeks ago
Helper function to send Discord messages
tuna

tuna9 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.