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=1526&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 17289 results for "function"(1590ms)

MyFootermain.tsx3 matches

@vladimyr•Updated 1 year ago
8const USERNAME = extractValInfo(import.meta.url).author;
9
10export async function createInjectMyFooterStream(logo = valTownLogoAuto) {
11 const footer = await MyFooter(logo);
12 return new InjectHTMLElementStream(footer.toString());
13}
14
15export async function MyFooter(logo = valTownLogoAuto) {
16 const recommendation = rootValRef().handle === USERNAME
17 ? html`<span class="recommends">${await recommends()}</span>`
41}
42
43export default async function(req) {
44 const { Layout } = await import("https://esm.town/v/postpostscript/Layout");
45 return htmlResponse`${Layout`

magentaDogmain.tsx2 matches

@Negash•Updated 1 year ago
1let currentNumber = 0; // Assuming starting point, but this could be loaded/stored elsewhere.
2
3// This function increments the number and returns the new value.
4function incrementNumber() {
5 currentNumber += 1;
6 // Here, you would ideally persist the current number to a database or file for long-term storage.

blogAuthmain.tsx1 match

@postpostscript•Updated 1 year ago
2import { getValEndpointFromName } from "https://esm.town/v/postpostscript/meta";
3
4export default function(req: Request) {
5 const { author, name } = extractValInfo(import.meta.url);
6 const blogEndpoint = getValEndpointFromName(`@${author}/blog`);

myIdeasmain.tsx1 match

@postpostscript•Updated 1 year ago
4import { getValEndpointFromName } from "https://esm.town/v/postpostscript/meta";
5
6export default function(req: Request) {
7 const { author, name } = extractValInfo(import.meta.url);
8 const blogEndpoint = getValEndpointFromName(`@${author}/blog`);

twitterAlertmain.tsx1 match

@pomdtr•Updated 1 year ago
4const query = "\"val.town\" OR \"val town\" -_ValTown_";
5
6export async function twitterAlert({ lastRunAt }: Interval) {
7 const results = await twitterSearch({
8 query,

authIdExampleCommentsmain.tsx1 match

@postpostscript•Updated 1 year ago
54export default app.fetch;
55
56async function createPage(c: Context<HonoEnvOptional>) {
57 const auth = c.get("auth");
58

inboxmain.tsx1 match

@pomdtr•Updated 1 year ago
1import { email as sendEmail } from "https://esm.town/v/std/email?v=11";
2
3export default async function(email: Email) {
4 await sendEmail({
5 subject: email.subject,

authMiddlewaremain.tsx12 matches

@pomdtr•Updated 1 year ago
25};
26
27async function normalizeOption<T>(value: MaybeMethod<T>, req: Request, payload: JWTPayload): Promise<T> {
28 return value instanceof Function
29 ? await value(req, payload)
30 : value;
31}
32
33export function getRequestContextRequest(context: ImplementsRequestContext) {
34 return "raw" in context.req
35 ? context.req.raw
47}
48
49export function authWrapperCookie(
50 handler: (req: Request, context: ImplementsRequestContext) => MaybePromise<Response>,
51 options: AuthMiddlewareOptions<ImplementsRequestContext> & {
79}
80
81export function authWrapperToken(
82 handler: (req: Request, context: ImplementsRequestContext) => MaybePromise<Response>,
83 options: AuthMiddlewareOptions<ImplementsRequestContext> & {
109}
110
111export function authMiddlewareToken<Context extends ImplementsRequestContext>(
112 options: Omit<AuthMiddlewareOptions<Context>, "requestScope"> & {
113 createResponse?: (context: Context, content: unknown, init?: ResponseInit) => MaybePromise<Response>;
161}
162
163export function authMiddlewareTokenQS<Context extends ImplementsRequestContext>(
164 options: Omit<AuthMiddlewareOptions<Context>, "requestScope"> & {
165 createResponse?: (context: Context, content: unknown, init?: ResponseInit) => MaybePromise<Response>;
213}
214
215export function authMiddlewareCookie<Context extends ImplementsRequestContext>(
216 options: AuthMiddlewareOptions<Context> & {
217 rootPath?: string;
261 };
262
263 function verifyAuthToken(token: string, req: Request) {
264 return verifyThirdParty(token, {
265 issuer: `@${handle}/authId`,
371 };
372
373 newPayload.requestScope = requestScope instanceof Function
374 ? await requestScope(req, name)
375 : requestScope;
451};
452
453export function userDisplay(payload: JWTPayload) {
454 return payload.sub.replace(/\/.*/, "");
455}
456
457export function userActionsDisplay(
458 payload: JWTPayload,
459 {

apiProxymain.tsx1 match

@postpostscript•Updated 1 year ago
33
34const ENDPOINT = getValEndpointFromUrl(import.meta.url);
35export function api(path: string, token: string, init: RequestInit = {}) {
36 return fetch(`${ENDPOINT}/${path.replace(/^\/+/, "")}`, {
37 ...init,

playgroundREADME.md1 match

@easrng•Updated 1 year ago
8- only script vals supported
9
10everything else should be fully functional.
11
12you can prefill the editor with

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