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=1577&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 19899 results for "function"(5328ms)

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);

restfulJsonBlobApimain.tsx9 matches

@anotherjesse•Updated 8 months ago
8const BLOB_PREFIX = "items_";
9
10export default async function server(request: Request): Promise<Response> {
11 const url = new URL(request.url);
12 const path = url.pathname;
58}
59
60async function getAllItems() {
61 const keys = await blob.list(BLOB_PREFIX);
62 const items = await Promise.all(
69}
70
71async function getItem(id: string) {
72 return await blob.getJSON(`${BLOB_PREFIX}${id}`);
73}
74
75async function createItem(item: any) {
76 const id = crypto.randomUUID();
77 await blob.setJSON(`${BLOB_PREFIX}${id}`, item);
79}
80
81async function updateItem(id: string, item: any) {
82 await blob.setJSON(`${BLOB_PREFIX}${id}`, item);
83}
84
85async function deleteItem(id: string) {
86 await blob.delete(`${BLOB_PREFIX}${id}`);
87}
88
89function jsonResponse(data: any, headers: HeadersInit, status = 200) {
90 return new Response(JSON.stringify(data), {
91 headers: { ...headers, "Content-Type": "application/json" },
94}
95
96function notFoundResponse(headers: HeadersInit) {
97 return new Response("Not Found", { headers, status: 404 });
98}
99
100function getInstructions() {
101 return `
102JSON Blob Storage API

zhangxiaokemain.tsx4 matches

@webup•Updated 8 months ago
8import { FileText, Trophy, Briefcase, Palette, Book, MessageCircle } from "https://esm.sh/lucide-react";
9
10function PersonalCard() {
11 return (
12 <div className="flex justify-center items-center min-h-screen bg-gray-100 p-4">
92}
93
94function App() {
95 return <PersonalCard />;
96}
97
98// client-side only code
99function client() {
100 createRoot(document.getElementById("root")).render(<App />);
101}
103
104// server-side only code
105export default async function server(request: Request): Promise<Response> {
106 return new Response(`
107 <!DOCTYPE html>

searchManifoldMarketsmain.tsx1 match

@adjacent•Updated 8 months ago
5 url: string;
6};
7export async function searchManifoldMarkets(query: string) {
8 const result = await fetch(
9 `https://manifold.markets/api/v0/search-markets?${query}`,

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.