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=1366&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 17279 results for "function"(2744ms)

freshBeigeScorpionmain.tsx4 matches

@jeffreyyoung•Updated 8 months ago
2 * Returns a response to the user's query
3 */
4async function getResponse(req: Query, send: SendEventFn) {
5 send("meta", { content_type: "text/markdown" });
6 send("text", {
27 * Returns your bot's settings
28 */
29async function getBotSettings(): Promise<BotSettings> {
30 return {
31 allow_attachments: true,
98) => void;
99
100function encodeEvent(event: string, data: any = {}) {
101 return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
102}
103
104export default async function(req: Request): Promise<Response> {
105 const reqBody = await req.json()
106 .catch((e) => {

bot1main.tsx4 matches

@jeffreyyoung•Updated 8 months ago
2 * Returns a response to the user's query
3 */
4async function getResponse(req: Query, send: SendEventFn) {
5 send("meta", { content_type: "text/markdown" });
6 const lastMessage = req.query.at(-1);
25 * Returns your bot's settings
26 */
27async function getBotSettings(): Promise<BotSettings> {
28 return {
29 allow_attachments: true,
87) => void;
88
89function encodeEvent(event: string, data: any = {}) {
90 return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
91}
92
93export default async function(req: Request): Promise<Response> {
94 const reqBody = await req.json().catch((e) => {
95 console.error("body parse error", e);

literaryIvorySlugmain.tsx4 matches

@jeffreyyoung•Updated 8 months ago
2 * Returns a response to the user's query
3 */
4async function getResponse(req: Query, send: SendEventFn) {
5 send("meta", { content_type: "text/markdown" });
6 const lastMessage = req.query.at(-1);
19 * Returns your bot's settings
20 */
21async function getBotSettings(): Promise<BotSettings> {
22 return {
23 allow_attachments: true,
90) => void;
91
92function encodeEvent(event: string, data: any = {}) {
93 return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
94}
95
96export default async function(req: Request): Promise<Response> {
97 const reqBody = await req.json().catch((e) => {
98 console.error("body parse error", e);

blobmain.tsx9 matches

@std•Updated 8 months ago
4
5/**
6 * Provides functions for interacting with your account's blob storage.
7 * Blobs can store any data type (text, JSON, images, etc.) and allow
8 * retrieval across different vals using the same key.
80};
81
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
94}
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
107}
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
123}
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
137}
138
139async function copy(previous: string, next: string) {
140 const res = await get(previous);
141 await set(next, res.body);
142}
143
144async function move(previous: string, next: string) {
145 await copy(previous, next);
146 await delete_(previous);
147}
148
149async function getJSON<T = unknown>(key: string): Promise<T> {
150 try {
151 const res = await get(key);
159}
160
161async function setJSON(key: string, value: any) {
162 return set(key, JSON.stringify(value));
163}

quickjsmain.tsx1 match

@maxm•Updated 8 months ago
3const QuickJS = await newQuickJSWASMModuleFromVariant(releaseVariant);
4
5async function main() {
6 const vm = QuickJS.newContext();
7

ogImagemain.tsx1 match

@moe•Updated 8 months ago
3import satori from "npm:satori"
4
5export async function ogImage(body) {
6 const svg = await satori(
7 body,

notionRecurringTasksmain.tsx1 match

@ciebiada•Updated 8 months ago
12};
13
14export default async function(interval: Interval) {
15 const response = await notion.databases.query({
16 database_id: DATABASE_ID,

slogan_historymain.tsx2 matches

@timqian•Updated 8 months ago
58];
59
60function classNames(...classes) {
61 return classes.filter(Boolean).join(" ");
62}
114};
115
116function Hero() {
117 return (
118 <div className="relative isolate overflow-hidden bg-white">

poeechobotmain.tsx3 matches

@jeffreyyoung•Updated 8 months ago
1async function getResponse(req: Query, send: Sender) {
2 send("meta", { content_type: "text/markdown" });
3 const lastMessage = req.query.at(-1);
44type Sender<EventName extends keyof Events = keyof Events> = (eventName: EventName, data: Events[EventName]) => void;
45
46function encodeEvent(event: string, data: any = {}) {
47 return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
48}
49
50export default async function(req: Request): Promise<Response> {
51 const body = new ReadableStream({
52 start(controller) {

poebotmain.tsx3 matches

@jeffreyyoung•Updated 8 months ago
1// protocol https://creator.poe.com/docs/poe-protocol-specification
2async function getResponse(req: any, send: (event: string, data?: any) => void) {
3 send("meta", { content_type: "text/markdown" });
4 send("text", { text: "```\n" + JSON.stringify(req, null, 3) + "\n```" });
6}
7
8function encodeEvent(event: string, data?: any = {}) {
9 return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
10}
11
12export default async function(req: Request): Promise<Response> {
13 let timerId: number | undefined;
14

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