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=1641&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 18188 results for "function"(8744ms)

auth_middlewareREADME.md1 match

@stevekrouse•Updated 1 year ago
14import { auth } from "https://esm.town/v/pomdtr/auth_middleware";
15
16async function handler(req: Request): Promise<Response> {
17 return new Response("You are authenticated!");
18}

test_authmain.tsx1 match

@pomdtr•Updated 1 year ago
1import { auth } from "https://esm.town/v/pomdtr/auth_middleware";
2
3async function handler(req: Request): Promise<Response> {
4 return new Response("You are authenticated!");
5}

sqlitemain.tsx2 matches

@saolsen•Updated 1 year ago
6import { get_tracer } from "https://esm.town/v/saolsen/tracing?v=136";
7
8async function traced_execute(statement: InStatement): Promise<ResultSet> {
9 return await get_tracer().startActiveSpan(`sqlite:execute`, async (span) => {
10 if (span.isRecording()) {
41}
42
43async function traced_batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
44 return await get_tracer().startActiveSpan(`sqlite:batch`, async (span) => {
45 if (span.isRecording()) {

fetchPaginatedDataREADME.md1 match

@nbbaier•Updated 1 year ago
1# Fetch Paginated Data
2
3This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with `next` and there to be a `data` property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
4
5Usage:

paginatedResponseREADME.md2 matches

@nbbaier•Updated 1 year ago
1# Return a paginated response
2
3A helper function to take an array and return a paginated response. This is useful when defining one's own folders for [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
4
5Usage:
8const data = [...]
9
10export default async function(req: Request): Promise<Response> {
11 return paginatedResponse(req, data);
12}

untitled_lavenderMarsupialmain.tsx1 match

@seflless•Updated 1 year ago
1function happy() {
2 return "😊";
3}

auth_middlewareREADME.md1 match

@pomdtr•Updated 1 year ago
16import { auth } from "https://esm.town/v/pomdtr/auth_middleware";
17
18async function handler(req: Request): Promise<Response> {
19 return new Response("You are authenticated!");
20}

http_handler_png_examplemain.tsx1 match

@bessarabov•Updated 1 year ago
1import { createCanvas } from "https://deno.land/x/canvas/mod.ts";
2
3export default async function(req: Request): Promise<Response> {
4 const width = 200;
5 const height = 200;

qstashmain.tsx2 matches

@saolsen•Updated 1 year ago
14
15export type PublishOpts = { url?: string; topic?: string };
16export async function publish(
17 body: object,
18 opts: PublishOpts
56});
57
58export async function receive(
59 body: string,
60 headers: Headers

tracingmain.tsx7 matches

@saolsen•Updated 1 year ago
13import { AsyncLocalStorageContextManager } from "npm:@opentelemetry/context-async-hooks";
14
15export function get_tracer() {
16 return trace.getTracer("valtown");
17}
20 * Initializes opentelemetry tracing.
21 */
22export function init(service_name: string, console_log: bool = false): undefined {
23 const provider = new WebTracerProvider({
24 resource: new Resource({
57 * be tied together.
58 */
59export async function traced_fetch(
60 input: string | URL,
61 init?: RequestInit,
98
99/**
100 * Wrapper to trace a function.
101 */
102// deno-lint-ignore no-explicit-any
131 * Takes an http handler and returns a new handler that
132 * traces the request.
133 * @returns {Function} A new handler that traces the request.
134 */
135export function traced_handler(
136 handler: (req: Request) => Promise<Response>,
137): (req: Request) => Promise<Response> {
138 async function _traced_hander(req: Request): Promise<Response> {
139 let active_context = null;
140 const prop_header = req.headers.get("b3");

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 2 weeks 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": "*",