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/image-url.jpg%20%22Image%20title%22?q=function&page=2724&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 29317 results for "function"(4980ms)

upgradeExpressREADME.md1 match

@easrng•Updated 1 year ago
3
4## How it works
5`upgradeExpress` wraps a Web handler into a function that works as normal when called by the Web API, and redirects to the Web API when called by the Express API.
6
7## Example

aliasmain.tsx1 match

@easrng•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
2
3export async function alias<P extends Params>(params: P): Promise<Result<P>> {
4 const username = params.username;
5 let url = `${API_URL}/v1/alias/${username}`;

aquaAlbatrossmain.tsx1 match

@devhelpr•Updated 1 year ago
1export function add(a, b) {
2 return a + b;
3}

embed_demomain.tsx1 match

@pomdtr•Updated 1 year ago
10`;
11
12export default function(req: Request) {
13 return new Response(
14 html,

blobCountermain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { blob } from "https://esm.town/v/std/blob?v=11";
2
3export default async function(req: Request): Promise<Response> {
4 const count = (await blob.getJSON("blobCounter") ?? 0) + 1;
5 await blob.setJSON("blobCounter", count);

dbmain.tsx1 match

@sqlite•Updated 1 year ago
2import type { ResultSet } from "npm:@libsql/client";
3
4async function execute(statement: InStatement): Promise<ResultSet> {
5 const resp = await fetch("https://sqlite-execute.web.val.run", {
6 method: "POST",

leaderboardmain.tsx1 match

@pomdtr•Updated 1 year ago
4import stripAnsi from "npm:strip-ansi";
5
6export default async function() {
7 const res = await db.execute(
8 "SELECT author_username, COUNT(*) AS val_count FROM vals GROUP BY author_username ORDER BY 2 DESC LIMIT 10",

sqliteBlobmain.tsx2 matches

@postpostscript•Updated 1 year ago
3import { blob as blobAPI } from "https://esm.town/v/std/blob";
4
5export async function sqliteBlob(options: SqliteBlobOptions = {}) {
6 const schema = sqliteBlobSchema(options);
7 const sqlite = createSqlite();
10}
11
12export async function sqliteBlobSchema(
13 { prefix = undefined, table = Statement`blobs`, blob = blobAPI }: SqliteBlobOptions = {},
14) {

sqliteUniversemain.tsx5 matches

@postpostscript•Updated 1 year ago
16};
17
18export function sqliteUniverseWithOptions(options: SqliteUniverseOptions) {
19 return {
20 execute(statement: InStatement) {
27}
28
29async function execute(
30 statement: InStatement,
31 options: SqliteUniverseOptions = {},
35}
36
37async function batch(
38 statements: InStatement[],
39 options: SqliteUniverseOptions = {},
83}
84
85async function createSqliteFromEndpointTables(
86 endpointTableMap: EndpointTableMap,
87 { interfaces = defaultInterfaces }: SqliteUniverseOptions = {},
90 let sqlite = await interfaces.exact?.[endpoint];
91
92 if (sqlite instanceof Function) {
93 sqlite = await sqlite({ endpoint, tables });
94 }

duckdbExamplemain.tsx1 match

@neverstew•Updated 1 year ago
3
4export let duckdbExample = (async () => {
5 async function createWorker(url: string) {
6 const workerScript = await fetch(url);
7 const workerURL = URL.createObjectURL(await workerScript.blob());
tuna

tuna9 file matches

@jxnblk•Updated 1 day ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.