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=1538&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 17935 results for "function"(1855ms)

pipesmain.tsx1 match

@pomdtr•Updated 12 months ago
12};
13
14export async function pipes(sql: string): Promise<Result> {
15 const origin = "https://pipes.turbot.com";
16 const pathname = `/api/latest/user/${user}/workspace/${workspace}/query`;

beigeSawfishmain.tsx1 match

@stevekrouse•Updated 12 months ago
1import { gzip } from "npm:pako";
2
3export default async function(req: Request): Promise<Response> {
4 return new Response(await gzip(JSON.stringify("hi".repeat(250_000))), {
5 headers: {

compress_responsemain.tsx1 match

@stevekrouse•Updated 12 months ago
1import { gzip } from "npm:pako";
2
3export default async function(req: Request): Promise<Response> {
4 return new Response(await gzip("hi".repeat(250_000)), {
5 headers: {

openapi_emailmain.tsx1 match

@pomdtr•Updated 12 months ago
1import { email } from "https://esm.town/v/std/email?v=11";
2
3export function forwarder(e: {
4 from: string;
5 to: string[];

openapi_schemamain.tsx8 matches

@pomdtr•Updated 12 months ago
531 parameters: {
532 query?: {
533 /** @description The args query parameter can provide arguments to the given val. The parameter needs to be a JSON-encoded array, in which each item in the array is passed to the val as a function parameter. */
534 args?: string;
535 };
566 };
567 };
568 /** @description Provide arguments to the given val function by including a post body with your request. */
569 requestBody?: {
570 content: {
596 * @description Runs `@{username}.{val_name}` as an Express handler.
597 *
598 * `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
599 *
600 * Unlike the other two APIs, the Express API is specified via subdomain and runs at `https://{username}-{val_name}.express.val.run`.
610 get: {
611 responses: {
612 /** @description Function executed successfully */
613 200: {
614 content: {
634 * @description Runs `@{username}.{val_name}` as an Express handler.
635 *
636 * `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
637 *
638 * ### Unauthenticated
652 };
653 responses: {
654 /** @description Function executed successfully */
655 200: {
656 content: {
847 /**
848 * @description The JavaScript or TypeScript expression to be evaluated.
849 * This should be a single expression, like a single function
850 * call, assignment operation, or calculation. If you need
851 * to execute multiple expressions, wrap them in a function.
852 */
853 expression: string;

aiREADME.md1 match

@yawnxyz•Updated 12 months ago
8
9```
10async function calculateEmbeddings(text) {
11 const url = `https://yawnxyz-ai.web.val.run/generate?embed=true&value=${encodeURIComponent(text)}`;
12

coralMulemain.tsx1 match

@pomdtr•Updated 12 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

syncmain.tsx2 matches

@pomdtr•Updated 12 months ago
10}
11
12export async function fetchEnv() {
13 const { data: res, error } = await fetchValTown("/v1/eval", {
14 method: "POST",
28}
29
30export async function fetchValTown<T = any>(
31 path: string,
32 options?: RequestInit & {

htmlExamplemain.tsx1 match

@robertfall•Updated 12 months ago
1// View at https://andreterron-htmlExample.web.val.run?name=Andre
2export default async function(req: Request): Promise<Response> {
3 const query = new URL(req.url).searchParams;
4

chatmain.tsx1 match

@kirineko•Updated 12 months ago
24 // });
25 // const message = data.choices[0].message;
26 // return message.function_call ? message.function_call : message.content;
27};
28

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