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=1112&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 18140 results for "function"(1764ms)

tsEvalindexPage1 match

@maxm•Updated 2 months ago
3import { renderToString } from "npm:react-dom/server";
4
5export default async function(req: Request): Promise<Response> {
6 const url = new URL(req.url);
7

SideProjectSaturdaylogic.ts3 matches

@justbe•Updated 2 months ago
17const guests: Record<string, Guest> = {};
18
19export function addGuest(name: string, email: string): string {
20 // Check if guest already exists with this email
21 const existingGuest = Object.values(guests).find(g => g.email === email);
36}
37
38export function getNextEventStatus(): EventStatus {
39 const now = new Date();
40 const nextSaturday = new Date(now);
60export type SignupData = z.infer<typeof SignupSchema>;
61
62export function getEventDateMessage(date: Date | null): string {
63 if (!date) return "Most Saturday Mornings";
64

valentines_day_card_generatorget-images1 match

@charmaine•Updated 2 months ago
9// };
10
11export async function getImages(type: string, count: number): Promise<string[]> {
12 // Query to select random rows of the specified type
13 const result = await sqlite.execute(

datemefaq1 match

@stevekrouse•Updated 2 months ago
4let linkClass = "text-sky-600 hover:text-sky-500";
5
6export default function FAQ(c) {
7 return c.html(
8 <Layout activeTab={new URL(c.req.url).pathname}>

datemebrowse4 matches

@stevekrouse•Updated 2 months ago
4import Layout from "./layout";
5
6function absoluteURL(url) {
7 if (url.startsWith("http://") || url.startsWith("https://"))
8 return url;
24let linkClass = "text-sky-600 hover:text-sky-500";
25
26function httpsIfy(url: string) {
27 if (!url.startsWith("http://") && !url.startsWith("https://")) {
28 return `https://${url}`;
31}
32
33function renderCell(header, row) {
34 let data = row[header];
35 if (header === "Name") {
45}
46
47export default async function Browse(c) {
48 const url = new URL(c.req.url);
49 const search = {

datemerss1 match

@stevekrouse•Updated 2 months ago
3import { zip } from "npm:lodash-es";
4
5export async function rss(req: Request) {
6 let { columns, rows } = await sqlite.execute(`select * from datemedocs order by LastUpdated desc limit 20`);
7 const profiles = rows.map(row =>
9// };
10
11export async function getImages(type: string, count: number): Promise<string[]> {
12 // Query to select random rows of the specified type
13 const result = await sqlite.execute(

valentines_day_card_generatorimage_uploader3 matches

@charmaine•Updated 2 months ago
4import { DATABASE_TABLENAME } from "./constants";
5
6function App() {
7 const [uploadStatus, setUploadStatus] = useState<string>("Drag and drop files here");
8 const [fileUrl, setFileUrl] = useState<string | null>(null);
155}
156
157function client() {
158 createRoot(document.getElementById("root")).render(<App />);
159}
160if (typeof document !== "undefined") { client(); }
161
162export default async function server(request: Request): Promise<Response> {
163 if (request.method === "POST" && new URL(request.url).pathname === "/upload") {
164 const { blob } = await import("https://esm.town/v/std/blob");

statusstatus3 matches

@yawnxyz•Updated 2 months ago
9const thisURL = parseProject(import.meta.url).links.self.project;
10
11function StatusRow({ rows }) {
12 return (
13 <div className="w-full flex flex-col space-y-2">
31}
32
33function StatusSection({ url, rows }) {
34 const sectionRows = rows.filter(row => row[0] === url);
35 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
47}
48
49export default async function(req: Request): Promise<Response> {
50 const { rows } = await sqlite.execute(
51 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

statussparklineSVG1 match

@yawnxyz•Updated 2 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
4 const xMargin = 25;

getFileEmail4 file matches

@shouser•Updated 1 week 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
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",