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=69&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 12287 results for "function"(743ms)

pondiversefetchCreations1 match

@iliazeus•Updated 5 days ago
3import { TABLE_NAME } from "./updateTable";
4
5export default async function(req: Request): Promise<Response> {
6 // First, get the row IDs of all rows that are older than 25 hours old
7 const res = await sqlite.execute(`

pondiverseaddCreation1 match

@iliazeus•Updated 5 days ago
4import { TABLE_NAME } from "./updateTable";
5
6export default async function(req: Request): Promise<Response> {
7 // body contains:
8 // - title (string)

JimeluStevenssendDailyBrief.ts6 matches

@luke_f•Updated 5 days ago
6import { formatMemoriesForPrompt, getRelevantMemories } from "../memoryUtils.ts";
7
8async function generateBriefingContent(anthropic, memories, today, isSunday) {
9 try {
10 const weekdaysHelp = generateWeekDays(today);
90}
91
92export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
93 // Get API keys from environment
94 const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
129 const lastSunday = today.startOf("week").minus({ days: 1 });
130
131 // Fetch relevant memories using the utility function
132 const memories = await getRelevantMemories();
133
210}
211
212function generateWeekDays(today) {
213 let output = [];
214
233// console.log(weekDays);
234
235// Export a function that calls sendDailyBriefing with no parameters
236// This maintains backward compatibility with existing cron jobs
237export default async function(overrideToday?: DateTime) {
238 return await sendDailyBriefing(undefined, overrideToday);
239}

JimeluStevenshandleUSPSEmail.ts3 matches

@luke_f•Updated 5 days ago
4const RECIPIENTS = ["Geoffrey", "Maggie"] as const;
5
6function parseDateFromSubject(subject: string): string | null {
7 const match = subject.match(/(\w{3}), (\d{1,2}\/\d{1,2})/);
8 if (match) {
19};
20
21async function analyzeHtmlContent(
22 anthropic: Anthropic,
23 htmlContent: string,
81}
82
83export default async function(e: Email) {
84 console.log("email content");
85 console.log(e.html);

CTGBreakerfarcaster.ts3 matches

@horsefacts•Updated 5 days ago
5export const name = "CTG Breaker";
6
7export function embedMetadata(baseUrl: string, path: string = "/") {
8 return {
9 version: "next",
23}
24
25export function handleFarcasterEndpoints(app: Hono) {
26 app.get("/.well-known/farcaster.json", (c) => {
27 const baseUrl = c.req.url.replace(c.req.path, "");
77const decodeBase64Json = (str: string) => JSON.parse(Buffer.from(str, "base64").toString("utf-8"));
78
79async function sendWelcomeNotification(fid: number, baseUrl: string) {
80 return await sendNotificationToUser(fid, {
81 title: name + " saved!",

CTGBreakerFarcasterMiniApp.tsx1 match

@horsefacts•Updated 5 days ago
4import { formatAddress, formatJSON, MonoButtonWithStatus, Section } from "./ui.tsx";
5
6export function FarcasterMiniApp() {
7 const [context, setContext] = useState<any>();
8 const [contextExpanded, setContextExpanded] = useState(false);

CTGBreakerindex.tsx1 match

@horsefacts•Updated 5 days ago
35});
36
37function generateHtml(baseUrl: string, path: string = "/"): any {
38 return (
39 <html>

my-first-valtest3 matches

@bugraipek•Updated 5 days ago
16];
17
18function App() {
19 return (
20 <div
45}
46
47function client() {
48 createRoot(document.getElementById("root")).render(<App />);
49}
50if (typeof document !== "undefined") { client(); }
51
52export default async function server(request: Request): Promise<Response> {
53 // If it's a GET request to the base path, serve the HTML
54 if (request.method === "GET" && new URL(request.url).pathname === "/") {

CTGBreakerimage.tsx4 matches

@horsefacts•Updated 5 days ago
5import satori from "npm:satori";
6
7export function handleImageEndpoints(app: Hono) {
8 const headers = {
9 "Content-Type": "image/png",
18}
19
20export async function homeImage() {
21 return await ogImage(
22 <img src="https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/7502b893-e726-408e-d7d0-9d9974517500/original" />,
24}
25
26export async function iconImage() {
27 return await ogImage(
28 <img src="https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/18baad43-5663-44ee-d9fc-c6d842d9cc00/original" />,
36//////////
37
38export async function ogImage(body, options = {}) {
39 const svg = await satori(
40 body,

JimeluStevensgetWeather.ts5 matches

@luke_f•Updated 5 days ago
5const TABLE_NAME = `memories`;
6
7function summarizeWeather(weather: WeatherResponse) {
8 const summarizeDay = (day: WeatherResponse["weather"][number]) => ({
9 date: day.date,
21}
22
23async function generateConciseWeatherSummary(weatherDay) {
24 try {
25 // Get API key from environment
79}
80
81async function deleteExistingForecast(date: string) {
82 await sqlite.execute(
83 `
89}
90
91async function insertForecast(date: string, forecast: string) {
92 const { nanoid } = await import("https://esm.sh/nanoid@5.0.5");
93
108}
109
110export default async function getWeatherForecast(interval: number) {
111 const weather = await getWeather("Sydney, Australia");
112 console.log({ weather });

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town