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/$%7Bart_info.art.src%7D?q=function&page=1566&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 20200 results for "function"(3854ms)

aigreetingmain.tsx1 match

@victorli•Updated 6 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function(req: Request): Promise<Response> {
4 const openai = new OpenAI();
5

musicFromPromptmain.tsx4 matches

@insectagon•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [prompt, setPrompt] = useState("");
7 const [isLoading, setIsLoading] = useState(false);
9 const [error, setError] = useState("");
10
11 async function generateImage() {
12 setIsLoading(true);
13 setError("");
51}
52
53function client() {
54 createRoot(document.getElementById("root")).render(<App />);
55}
59}
60
61export default async function server(req: Request): Promise<Response> {
62 return new Response(`
63 <!DOCTYPE html>

modifyImagemain.tsx1 match

@darefail•Updated 6 months ago
1import { ImageMagick, initializeImageMagick, MagickGeometry } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts";
2
3export async function modifyImage(
4 file: File,
5 params: { width: number; height: number },

modifyImage_deleted_1729627407main.tsx1 match

@darefail•Updated 6 months ago
1import { ImageMagick, initializeImageMagick, MagickGeometry } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts";
2
3export async function modifyImage(
4 file: File,
5 params: { width: number; height: number },

promptOrangeHookwormmain.tsx6 matches

@rohernan76•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [weather, setWeather] = useState(null);
7
33}
34
35function client() {
36 createRoot(document.getElementById("root")).render(<App />);
37}
39if (typeof document !== "undefined") { client(); }
40
41export default async function server(request: Request): Promise<Response> {
42 if (request.url.endsWith('/weather')) {
43 const weatherData = await fetchWeather();
67}
68
69function celsiusToFahrenheit(celsius: number): number {
70 return Math.round((celsius * 9/5) + 32);
71}
72
73async function fetchWeather() {
74 const response = await fetch(
75 'https://api.open-meteo.com/v1/forecast?latitude=40.5853&longitude=-105.0844&current_weather=true&daily=temperature_2m_max,temperature_2m_min&timezone=America%2FDenver'
84}
85
86function getWeatherCondition(code: number): string {
87 const conditions: { [key: number]: string } = {
88 0: 'Clear sky',

practicalBeigeCapybaramain.tsx3 matches

@stevekrouse•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [activeTab, setActiveTab] = useState('home');
7
43}
44
45function client() {
46 createRoot(document.getElementById("root")).render(<App />);
47
60if (typeof document !== "undefined") { client(); }
61
62export default async function server(request: Request): Promise<Response> {
63 const url = new URL(request.url);
64

tomasoValmaxmain.tsx6 matches

@all•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function SoundMaker() {
6 const [isRecording, setIsRecording] = useState(false);
7 const [recordedNotes, setRecordedNotes] = useState([]);
72}
73
74function Meditation() {
75 const mantras = [
76 "Tokens flow, I am whole",
189}
190
191function TokenAnimation() {
192 const canvasRef = useRef(null);
193
243}
244
245function App() {
246 const [isDarkMode, setIsDarkMode] = useState(false);
247 const [currentFeature, setCurrentFeature] = useState("intro");
299}
300
301function client() {
302 createRoot(document.getElementById("root")).render(<App />);
303}
307}
308
309export default async function server(request: Request): Promise<Response> {
310 return new Response(
311 `

helloWorldmain.tsx1 match

@campsite•Updated 6 months ago
10const CHANNEL_ID = "<project_id>";
11
12async function main() {
13 const body = {
14 title: "Hello World",

githubPRAlertmain.tsx1 match

@campsite•Updated 6 months ago
27const PR_ALERTS_CHANNEL_ID = "izu9x0b54xy2";
28
29export default async function server(request: Request): Promise<Response> {
30 if (request.method !== "POST") {
31 return new Response("Method not allowed", { status: 405 });

email_channelmain.tsx1 match

@campsite•Updated 6 months ago
19const campsite = new Campsite({ apiKey: CAMPSITE_API_KEY });
20
21export async function emailValHandler(payload: Email) {
22 // ignore emails sent to the public val :)
23 if (payload.to === "campsite.email_channel@valtown.email") {

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 3 weeks 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.