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%20%22Optional%20title%22?q=function&page=2798&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 34884 results for "function"(9795ms)

whiteNewtmain.tsx2 matches

@maxm•Updated 5 months ago
3import { renderToString } from "npm:react-dom/server";
4
5export default async function(req: Request): Promise<Response> {
6 return new Response(
7 renderToString(
13 {`let hasAnError: string = 10;
14
15function increment(num: number) {
16 return num + 1;
17}

aqimain.tsx1 match

@danielmorgan•Updated 5 months ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "12494"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

braintrustSDKBrokenmain.tsx1 match

@charmaine•Updated 5 months ago
2import { Eval } from "npm:braintrust@0.01";
3
4export default async function handler() {
5 const result = {
6 apiKeyStatus: null,

OpenAImain.tsx1 match

@Yogareddy107•Updated 5 months ago
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.

YoutubeSearchAppmain.tsx5 matches

@aazad•Updated 5 months ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5// Utility function for password hashing
6async function hashPassword(password: string) {
7 const encoder = new TextEncoder();
8 const data = encoder.encode(password);
13}
14
15function App() {
16 const [searchQuery, setSearchQuery] = useState("");
17 const [videos, setVideos] = useState([]);
111}
112
113function client() {
114 createRoot(document.getElementById("root")).render(<App />);
115}
116if (typeof document !== "undefined") { client(); }
117
118export default async function server(request: Request): Promise<Response> {
119 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
120 const KEY = "YoutubeSearchApp";

opensaasmain.tsx1 match

@mmaksimovic•Updated 5 months ago
1import { capturePostHogEvent } from "https://esm.town/v/ianvph/capturePostHogEvent";
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method !== "POST") {
5 return Response.json({ ok: "only post request" });

posthogGitHubStarCapturemain.tsx1 match

@mmaksimovic•Updated 5 months ago
1import { capturePostHogEvent } from "https://esm.town/v/ianvph/capturePostHogEvent";
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method !== "POST") {
5 return Response.json({ ok: "only post request" });

linkinbio_25_2_5main.tsx3 matches

@aazad•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function LinkInBio() {
6 // Brutalist design profile data
7 const profileData = {
135}
136
137function client() {
138 createRoot(document.getElementById("root")).render(<LinkInBio />);
139}
140if (typeof document !== "undefined") { client(); }
141
142export default async function server(request: Request): Promise<Response> {
143 return new Response(`
144 <html>

gitHubSyncmain.tsx4 matches

@charmaine•Updated 5 months ago
277});
278
279function Style() {
280 return (
281 <style>
294}
295
296function Logout() {
297 return (
298 <form action="/logout" method="post">
318
319/**
320 * This function can be used on its own
321 * to commit multiple files to a GitHub repo
322 */
323export async function commitFiles({
324 token,
325 owner,

wordRangeFindermain.tsx3 matches

@jrunning•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [words, setWords] = useState<string[]>([]);
7 const [startWord, setStartWord] = useState('');
68}
69
70function client() {
71 createRoot(document.getElementById("root")).render(<App />);
72}
73if (typeof document !== "undefined") { client(); }
74
75export default async function server(request: Request): Promise<Response> {
76 const url = new URL(request.url);
77

discordWebhook2 file matches

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