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/$%7Bart_info.art.src%7D?q=function&page=1668&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 18617 results for "function"(3552ms)

reduceAsyncmain.tsx4 matches

@postpostscript•Updated 1 year ago
8 | ((acc: U, next: T, index: number, values: T[]) => MaybePromise<U>);
9
10export async function reduceAsync<U, T>(
11 values: T[],
12 reducer: (acc: T, next: T, index: number, values: T[]) => MaybePromise<T>,
13): Promise<T>;
14export async function reduceAsync<U, T>(
15 values: T[],
16 reducer: (acc: T, next: T, index: number, values: T[]) => MaybePromise<T>,
17 initialValue: T,
18): Promise<T>;
19export async function reduceAsync<U, T>(
20 values: T[],
21 reducer: (acc: U, next: T, index: number, values: T[]) => MaybePromise<U>,
23): Promise<U>;
24
25export async function reduceAsync<U, T>(
26 values: T[],
27 reducer: AsyncReducer<U, T>,

myIdeasREADME.md1 match

@postpostscript•Updated 1 year ago
7- [ ] sync sqlite between accounts
8- [x] provide read only query access to sqlite: [@postpostscript/sqlitePublic](https://val.town/v/postpostscript/sqlitePublic)
9- [x] `backup` function that backs up everything on your account (still queryable through @postpostscript/sqliteUniverse): [@postpostscript/sqliteBackup](https://val.town/v/postpostscript/sqliteBackup)
10- [ ] authenticated poll
11- [ ] sign data left on other account to prevent impersonation

example_componentmain.tsx1 match

@pomdtr•Updated 1 year ago
3import { useEffect, useState } from "https://esm.sh/react";
4
5export default function Component() {
6 const [text, setText] = useState("from server");
7

chillmain.tsx1 match

@pomdtr•Updated 1 year ago
12};
13
14export function createRoute(handler: Handler) {
15 return async (ctx: Context) => {
16 if (typeof handler == "object") {

ssrmain.tsx1 match

@pomdtr•Updated 1 year ago
15export type Action = (req: Request, ctx: Context) => Response | Promise<Response>;
16
17export function handler(Component, action?: Action) {
18 return async (c) => {
19 if (action) {

hashmain.tsx1 match

@postpostscript•Updated 1 year ago
1export type ShaAlgorithm = "SHA-256" | "SHA-512";
2
3export async function sha(
4 input: string | BufferSource | AsyncIterable<BufferSource> | Iterable<BufferSource>,
5 algo: ShaAlgorithm = "SHA-256",

midnightpubFeedmain.tsx2 matches

@vladimyr•Updated 1 year ago
8const reUserFeed = /^\/(?<username>~[a-z0-9-_]+)\.(?<format>atom|rss)$/;
9
10export default async function(req: Request): Promise<Response> {
11 const { pathname } = new URL(req.url);
12 const match = pathname.match(reUserFeed);
49}
50
51async function grabPosts(profileURL: string | URL) {
52 const html = await ky.get(profileURL).text();
53 const doc = new DOMParser().parseFromString(html, "text/html");

testmain.tsx1 match

@postpostscript•Updated 1 year ago
23}
24
25export function testContext<TOptions extends TestContextOptions>(options: TOptions) {
26 const tests: Test<TOptions>[] = [];
27

createValFromCljsmain.tsx1 match

@liamdanielduffy•Updated 1 year ago
2import { updateValByName } from "https://esm.town/v/nbbaier/updateValByName";
3
4export async function createValFromCljs(name: string, cljs: string) {
5 return updateValByName({
6 token: Deno.env.get("valtown"),

compileCljsToES6main.tsx1 match

@liamdanielduffy•Updated 1 year ago
4globalThis.squint_core = squint_core;
5
6export function compileCljsToES6(cljs: string) {
7 return compileString(cljs, { repl: true, "elide-exports": true }).replace(
8 "squint-cljs",

getFileEmail4 file matches

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