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=844&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 16278 results for "function"(1889ms)

fearlessPlumHerringmain.tsx3 matches

@mur•Updated 2 months ago
45`;
46
47function getYesterdayDateRange(): { startDate: string; endDate: string } {
48 const now = new Date();
49 const yesterday = new Date(now.setDate(now.getDate() - 1));
56}
57
58export async function exec(interval: Interval) {
59 const apiKey = Deno.env.get("LINEAR_API_KEY");
60 if (!apiKey) {
132 });
133
134 function determineMatchedContext(
135 history: any[],
136 startDate: string,

execmain.tsx3 matches

@mur•Updated 2 months ago
45`;
46
47function getYesterdayDateRange(): { startDate: string; endDate: string } {
48 const now = new Date();
49 const yesterday = new Date(now.setDate(now.getDate() - 1));
56}
57
58export async function exec(interval: Interval) {
59 const apiKey = Deno.env.get("LINEAR_API_KEY");
60 if (!apiKey) {
132 });
133
134 function determineMatchedContext(
135 history: any[],
136 startDate: string,

patientYellowBeavermain.tsx1 match

@sahebdad•Updated 2 months ago
2import { email } from "https://esm.town/v/std/email";
3
4export default async function(interval: Interval) {
5 const locale = "de/de";
6 const stores = [117, 187, 226];

Expensemain.tsx2 matches

@sahebdad•Updated 2 months ago
5// Rest of the client-side code remains the same...
6
7export default async function server(request: Request): Promise<Response> {
8 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
9 const KEY = "Expense";
18 }> = {};
19
20 // Enhanced cookie parsing function
21 const parseCookies = (cookieHeader: string | null): Record<string, string> => {
22 console.log("Raw Cookie Header:", cookieHeader);

researchAgentemailHandler2 matches

@wasauce•Updated 2 months ago
4import { OpenAI } from "npm:openai";
5
6function pm(...lines: string[]): string {
7 return lines.join("\n");
8}
9
10export async function emailValHandler(inboundEmail: Email) {
11 const userPrompt = pm(
12 `From: ${inboundEmail.from}`,

interestCalculatormain.tsx3 matches

@Babalu•Updated 2 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [principal, setPrincipal] = useState('');
7 const [rate, setRate] = useState('');
83}
84
85function client() {
86 createRoot(document.getElementById("root")).render(<App />);
87}
88if (typeof document !== "undefined") { client(); }
89
90export default async function server(request: Request): Promise<Response> {
91 if (request.method === 'POST') {
92 const { principal, rate, months } = await request.json();

researchAgentmorningAiNewsletter1 match

@charmaine•Updated 2 months ago
1import { emailValHandler } from "./emailHandler";
2
3export default async function(interval: Interval) {
4 const today = new Intl.DateTimeFormat("en-US", {
5 month: "short",

getProjectsAsZipsMessageInput.tsx1 match

@charmaine•Updated 2 months ago
3import type { Message } from "../shared/types.ts";
4
5export function MessageInput({ onSubmit }: { onSubmit: () => void }) {
6 const [message, setMessage] = React.useState("");
7

getProjectsAsZipsREADME.md2 matches

@charmaine•Updated 2 months ago
15In a normal server environment, you would likely use a middleware [like this one](https://hono.dev/docs/getting-started/nodejs#serve-static-files) to serve static files. Some frameworks or deployment platforms automatically make any content inside a `public/` folder public.
16
17However in Val Town you need to handle this yourself, and it can be suprisingly difficult to read and serve files in a Val Town Project. This template uses helper functions from [stevekrouse/utils/serve-public](https://www.val.town/x/stevekrouse/utils/branch/main/code/serve-public/README.md), which handle reading project files in a way that will work across branches and forks, automatically transpiles typescript to javascript, and assigns content-types based on the file's extension.
18
19### `index.html`
25## CRUD API Routes
26
27This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
28
29## Errors

getProjectsAsZipsindex.ts2 matches

@charmaine•Updated 2 months ago
61});
62
63async function getFilesWithContent(files: any[], projectId) {
64 const nonDirectoryFiles = files.filter(file => file.type !== "directory");
65
97}
98
99async function createZipFromEndpoints(
100 files: any[],
101 zipFileName: string,

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
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": "*",