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=2463&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 28554 results for "function"(2470ms)

clickTrackerWebsitemain.tsx3 matches

@ankitkr0•Updated 9 months ago
7import confetti from 'https://esm.sh/canvas-confetti';
8
9function App() {
10 const [clicks, setClicks] = useState(0);
11
49}
50
51function client() {
52 createRoot(document.getElementById("root")).render(<App />);
53}
55if (typeof document !== "undefined") { client(); }
56
57async function server(request: Request): Promise<Response> {
58 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
59 const SCHEMA_VERSION = 2

lucia_sqlitemain.tsx5 matches

@yawnxyz•Updated 9 months ago
4import { generateId, Scrypt } from "npm:lucia";
5
6export async function createTables(userTable: string, sessionTable: string) {
7 return sqlite.batch([
8 `CREATE TABLE ${userTable} (
22}
23
24async function safeExecute({ userTable, sessionTable, query, error }: {
25 userTable: string;
26 sessionTable: string;
40}
41
42export async function createUser({ userTable, sessionTable, username, password, github_id, google_id }: {
43 userTable: string;
44 sessionTable: string;
65}
66
67export async function getUser(
68 { userTable, sessionTable, username, github_id, google_id }: {
69 userTable: string;
98}
99
100export async function verifyPassword(hashed_password: string, password: string): Promise<boolean> {
101 return new Scrypt().verify(hashed_password, password);
102}

bedtimeStoryMakermain.tsx1 match

@daniellevine•Updated 9 months ago
36// );
37
38function parseStory(text) {
39 // Split the text into lines and remove empty lines
40 const lines = text.split("\n").filter(line => line.trim() !== "");

hnCloneLuciaOauthmain.tsx3 matches

@yawnxyz•Updated 9 months ago
9import { luciaMiddleware } from "https://esm.town/v/yawnxyz/lucia_middleware_safe";
10
11function App() {
12 const [stories, setStories] = useState([]);
13 const [user, setUser] = useState(null);
174}
175
176function client() {
177 createRoot(document.getElementById("root")).render(<App />);
178}
179if (typeof document !== "undefined") { client(); }
180
181export default luciaMiddleware(async function server(request: Request): Promise<Response> {
182 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
183 const SCHEMA_VERSION = 3

victoriousRoseMothmain.tsx1 match

@ezomode•Updated 9 months ago
11`);
12
13export default async function(req: Request): Promise<Response> {
14 const res = await db.query(`
15 UPDATE test

muddyAmethystLimpetmain.tsx3 matches

@pdebieamzn•Updated 9 months ago
13const localizer = momentLocalizer(moment);
14
15function App() {
16 const [events, setEvents] = useState([]);
17 const [isLoading, setIsLoading] = useState(false);
114}
115
116function client() {
117 createRoot(document.getElementById("root")).render(<App />);
118}
120if (typeof document !== "undefined") { client(); }
121
122async function server(request: Request): Promise<Response> {
123 const { OpenAI } = await import("https://esm.town/v/std/openai");
124 const pdfExtractText = await import("https://esm.town/v/pdebieamzn/pdfExtractText");

calendarEventExtractormain.tsx3 matches

@pdebieamzn•Updated 9 months ago
12const localizer = momentLocalizer(moment);
13
14function App() {
15 const [events, setEvents] = useState([]);
16 const [isLoading, setIsLoading] = useState(false);
75}
76
77function client() {
78 createRoot(document.getElementById("root")).render(<App />);
79}
81if (typeof document !== "undefined") { client(); }
82
83async function server(request: Request): Promise<Response> {
84 const { OpenAI } = await import("https://esm.town/v/std/openai");
85 const pdfExtractText = await import("https://esm.town/v/pdebieamzn/pdfExtractText");

pdfExtractTextmain.tsx1 match

@pdebieamzn•Updated 9 months ago
1import { PDFExtract, PDFExtractOptions } from "npm:pdf.js-extract";
2
3export default async function pdfExtractText(data: ArrayBuffer) {
4 const pdfExtract = new PDFExtract();
5 // const req = await fetch("https://morth.nic.in/sites/default/files/dd12-13_0.pdf");

hackerNewsDigestmain.tsx4 matches

@parkerdavis•Updated 9 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
15}
16
17function createStoryHTML(story: any) {
18 return `
19 <li>
28}
29
30function createEmailContent(
31 topStories: any[],
32 newStories: any[],
118}
119
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);

serveGithubRepomain.tsx1 match

@pomdtr•Updated 9 months ago
3import { extname, join } from "jsr:@std/path@0.225.2";
4
5export function serveGithubRepo(params: {
6 owner: string;
7 repo: string;

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.