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/?q=function&page=924&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 18181 results for "function"(1180ms)

CatVisionmain.tsx6 matches

@recklessreticence•Updated 2 months ago
4import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
5
6function App() {
7 return (
8 <div className="cat-vision-app">
15}
16
17function CatVisionSimulator() {
18 const [imageUrl, setImageUrl] = useState("/api/placeholder/600/400");
19 const [catVisionEnabled, setCatVisionEnabled] = useState(false);
27 const fileInputRef = useRef(null);
28
29 // Function to handle file upload
30 const handleFileUpload = (e) => {
31 const file = e.target.files[0];
44 };
45
46 // Function to apply cat vision filter to the image
47 const applyCatVision = (img, canvas, ctx) => {
48 ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
503}
504
505function client() {
506 const rootElement = document.getElementById("root");
507 if (!rootElement) throw new Error("Root element not found");
884`;
885
886export default async function server(request: Request): Promise<Response> {
887 return new Response(
888 `

knowledgeableBlueMartenmain.tsx4 matches

@Alcial•Updated 2 months ago
47};
48
49function AdvancedAdmissionPredictor() {
50 const [studentData, setStudentData] = useState({
51 jeeRank: '',
183 }
184
185 // Cleanup function to destroy charts
186 return () => {
187 Object.values(chartInstancesRef.current).forEach(chart => chart?.destroy());
285}
286
287function client() {
288 const rootElement = document.getElementById('root');
289 if (rootElement) {
296}
297
298export default async function server(request: Request): Promise<Response> {
299 return new Response(`
300 <html>

fmain.tsx1 match

@f2realw•Updated 2 months ago
76
77 <script>
78 function handleRSVP(response) {
79 const name = document.getElementById('name').value;
80 if (!name) {

breakmain.tsx1 match

@fatimazahra_10•Updated 2 months ago
1export default async function(interval: Interval) {
2 console.log("Hello World! This task runs every 15 minutes.");
3}

valentinemain.tsx1 match

@f2realw•Updated 2 months ago
2import { renderToString } from "npm:react-dom@18.2.0/server";
3
4export default async function App() {
5 const [isAttending, setIsAttending] = false;
6 const [noClicks, setNoClicks] = 0;

insightfulPinkOttermain.tsx1 match

@fatimazahra_10•Updated 2 months ago
1export default async function (interval: Interval) {
2
3}

reactHonoStarterApp.tsx1 match

@jxnblk•Updated 2 months ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (

steel_puppeteer_startermain.tsx3 matches

@brokencircuits•Updated 2 months ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [messages, setMessages] = useState([
7 { role: "system", content: "You are a helpful AI assistant." },
126}
127
128function client() {
129 createRoot(document.getElementById("root")).render(<App />);
130}
131if (typeof document !== "undefined") { client(); }
132
133export default async function server(request: Request): Promise<Response> {
134 if (request.method === "POST") {
135 const { messages, model } = await request.json();

replicate_starterApp.tsx1 match

@stevekrouse•Updated 2 months ago
3import React from "https://esm.sh/react@18.2.0";
4
5function ImageGenerator() {
6 const [prompt, setPrompt] = React.useState("");
7 const [images, setImages] = React.useState<any>([]);

spagserver.ts1 match

@stevekrouse•Updated 2 months ago
2import { parseProject, serveFile } from "https://esm.town/v/std/utils@64-main/index.ts";
3
4export default async function(req: Request): Promise<Response> {
5 const path = new URL(req.url).pathname;
6

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",