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%22Image%20title%22?q=function&page=2423&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 28348 results for "function"(3592ms)

linkInBioTemplatemain.tsx1 match

@opeala•Updated 8 months ago
12import { renderToString } from "npm:react-dom/server";
13
14export default async function(req: Request) {
15 return new Response(
16 renderToString(

snakeclonemain.tsx5 matches

@parsadotsh•Updated 8 months ago
7const CELL_SIZE = CANVAS_SIZE / GRID_SIZE;
8
9function ChatRoom() {
10 const [messages, setMessages] = useState([]);
11 const [inputMessage, setInputMessage] = useState('');
46}
47
48function SnakeGame() {
49 const [snake, setSnake] = useState([{ x: 10, y: 10 }]);
50 const [food, setFood] = useState({ x: 15, y: 15 });
127}
128
129function App() {
130 const [currentView, setCurrentView] = useState('menu');
131
157}
158
159function mountApp() {
160 const root = document.getElementById("root");
161 if (root) {
166}
167
168async function server(request: Request): Promise<Response> {
169 return new Response(`
170 <html>

missingRosePonymain.tsx1 match

@jakub_tel•Updated 8 months ago
4import { currency } from "https://esm.town/v/stevekrouse/currency";
5
6export default async function btcPriceAlert() {
7 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8 let btcPrice = await currency("usd", "btc");

weekWorkoutIconsmain.tsx1 match

@andreterron•Updated 8 months ago
4import { addDays, format } from "npm:date-fns@2.30.0";
5
6export function weekWorkoutIcons(
7 byDay: Record<string, any>,
8 timezone: string = "America/Los_Angeles",

setTidbytImagemain.tsx1 match

@andreterron•Updated 8 months ago
7];
8
9export async function setTidbytImage({ image }: {
10 image: string;
11}) {

scientificCyanHarriermain.tsx3 matches

@stevekrouse•Updated 8 months ago
4import { vtTokenSessionAuth } from "https://esm.town/v/stevekrouse/vtTokenSessionAuthSafe";
5
6function App() {
7 const [tables, setTables] = useState([]);
8 const [selectedTable, setSelectedTable] = useState(null);
214}
215
216function client() {
217 createRoot(document.getElementById("root")).render(<App />);
218}
222}
223
224async function server(request: Request): Promise<Response> {
225 try {
226 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

whoIsHiringHomemain.tsx1 match

@vawogbemi•Updated 8 months ago
2import { Dispatch } from "https://esm.sh/react";
3
4export default function Home(
5 dispatch: Dispatch<{
6 type: string;

tidbytStarmain.tsx1 match

@andreterron•Updated 8 months ago
1import { tidbytCircle } from "https://esm.town/v/andreterron/tidbytCircle";
2
3export async function tidbytStar({ size = 7, bg = 0x047857ff, star = 0xffffffff }: {
4 size?: number;
5 bg?: number;

duckDBmain.tsx1 match

@adjacent•Updated 8 months ago
1import { Database } from "https://esm.sh/duckdb-async";
2
3export default async function server(request: Request): Promise<Response> {
4 const url = new URL(request.url);
5 const dataUrl = url.searchParams.get('url');

cohostSanitizemain.tsx1 match

@easrng•Updated 8 months ago
214};
215
216export function cohostSanitize(html: string, document: Document): Node {
217 const unsafeTree = fromHtml(html, { fragment: true });
218 const safeTree = sanitize(unsafeTree, FIFTH_AGE.schema);

getFileEmail4 file matches

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

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