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=1313&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 18516 results for "function"(1568ms)

SendErrorToDiscordmain.tsx1 match

@faekiva•Updated 5 months ago
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export async function reportErrorAndExit(source: string, message: string) {
4 let content = "# Error from " + source;
5 const append = (text: string) => {

encouragingAmethystTickmain.tsx1 match

@efsmert•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2async function fetchRandomJoke() {
3 const response = await fetch(
4 "https://official-joke-api.appspot.com/random_joke",

amicableAquamarinePanthermain.tsx1 match

@krishad29•Updated 5 months ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = fetch(
6 "https://official-joke-api.appspot.com/random_joke",

CS1200main.tsx1 match

@timpineda•Updated 5 months ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

constantTomatoTarantulamain.tsx1 match

@henrique056•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3async function fetchRandomJoke() {
4 const response = await fetch(
5 "https://official-joke-api.appspot.com/random_joke",

CS1200Projmain.tsx2 matches

@bhuvanh66•Updated 5 months ago
2
3// Fetches a random joke.
4function fetchRandomJoke() {
5 async function fetchRandomJoke() {
6 const response = await fetch(
7 "https://official-joke-api.appspot.com/random_joke",

readablemain.tsx1 match

@neverstew•Updated 5 months ago
2import { JSDOM } from "npm:jsdom";
3
4export default async function(req: Request) {
5 let resp = await fetch(`https://${new URL(req.url).pathname.replace(/^https?:\/\//, '')}`, req);
6 let body = await resp.text();

uptimemain.tsx6 matches

@vyatka•Updated 5 months ago
5
6// Existing uptime check logic
7async function uptimeCheck(url: string) {
8 let reason: string, status: number, end: number;
9 let ok = true;
40
41// Run uptime checks on startup
42async function runUptimeChecks() {
43 ["https://students.kpfu.ru", "https://media.kpfu.ru"].forEach(uptimeCheck);
44}
46
47// React Frontend Component
48function UptimeDashboard() {
49 const [uptimeData, setUptimeData] = useState([]);
50 const [loading, setLoading] = useState(true);
51
52 useEffect(() => {
53 async function fetchUptimeData() {
54 try {
55 const response = await fetch('/uptime-data');
111
112// Client-side rendering
113function client() {
114 createRoot(document.getElementById("root")).render(<UptimeDashboard />);
115}
117
118// Server-side handler
119export default async function server(request: Request): Promise<Response> {
120 const url = new URL(request.url);
121

theOneSkymain.tsx9 matches

@karkowg•Updated 5 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function createTypewriterMachine() {
7 const messages = ["The bsky has you...", "Follow the blue butterfly", "made with val.town"];
8
89}
90
91function MatrixBlueskyStream() {
92 const [posts, setPosts] = useState([]);
93 const canvasRef = useRef(null);
102 const [machineState, setMachineState] = useState(typewriterMachine.current.initialState);
103
104 // Wrapper function to update state
105 const updateMachineState = useCallback((event) => {
106 const newState = typewriterMachine.current.transition(machineState, event);
135 const agent = new BskyAgent({ service: "https://bsky.social" });
136
137 async function streamPosts() {
138 try {
139 await agent.login({
208 }));
209
210 function draw() {
211 try {
212 ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
248 const animationFrame = setInterval(draw, 33);
249
250 // Cleanup function
251 return () => {
252 clearInterval(animationFrame);
355}
356
357function App() {
358 return <MatrixBlueskyStream />;
359}
360
361function client() {
362 createRoot(document.getElementById("root")).render(<App />);
363}
365if (typeof document !== "undefined") { client(); }
366
367export default async function server(request: Request): Promise<Response> {
368 return new Response(
369 `

iheartjankboteko1main.tsx1 match

@iheartjankboteko•Updated 5 months ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

getFileEmail4 file matches

@shouser•Updated 2 weeks 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
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.