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=1646&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 18181 results for "function"(2425ms)

twitterWrappermain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { twitterJSON } from "https://esm.town/v/stevekrouse/twitterJSON";
3
4export default async function(req: Request): Promise<Response> {
5 if (req.headers.get("authorization") !== "Bearer " + Deno.env.get("boozedog"))
6 return Response.json("Unauthorized", { status: 401 });

myApimain.tsx1 match

@boozedog•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

untitled_harlequinDragonmain.tsx1 match

@bantic•Updated 1 year ago
1export default function() {
2 console.log("hi");
3 return "foo";

use_example_rust_http_valmain.tsx1 match

@saolsen•Updated 1 year ago
1import { handler } from "https://esm.town/v/saolsen/example_rust_http_val";
2
3export default async function(req: Request): Promise<Response> {
4 let response = handler(req.method, req.url, await req.text());
5 console.log(response);

example_rust_http_valmain.tsx12 matches

@saolsen•Updated 1 year ago
17let cachedUint8Memory0 = null;
18
19function getUint8Memory0() {
20 if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
21 cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
24}
25
26function getStringFromWasm0(ptr, len) {
27 ptr = ptr >>> 0;
28 return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
33let cachedTextEncoder = new TextEncoder("utf-8");
34
35const encodeString = typeof cachedTextEncoder.encodeInto === "function"
36 ? function(arg, view) {
37 return cachedTextEncoder.encodeInto(arg, view);
38 }
39 : function(arg, view) {
40 const buf = cachedTextEncoder.encode(arg);
41 view.set(buf);
46 };
47
48function passStringToWasm0(arg, malloc, realloc) {
49 if (realloc === undefined) {
50 const buf = cachedTextEncoder.encode(arg);
85let cachedInt32Memory0 = null;
86
87function getInt32Memory0() {
88 if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
89 cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
96heap.push(undefined, null, true, false);
97
98function getObject(idx) {
99 return heap[idx];
100}
102let heap_next = heap.length;
103
104function dropObject(idx) {
105 if (idx < 132) return;
106 heap[idx] = heap_next;
108}
109
110function takeObject(idx) {
111 const ret = getObject(idx);
112 dropObject(idx);
119 * @returns {string}
120 */
121export const handler = imports.handler = function(method, url, _body) {
122 let deferred5_0;
123 let deferred5_1;
151};
152
153export const __wbg_log_18b11754c5793c04 = imports.__wbg_log_18b11754c5793c04 = function(arg0, arg1) {
154 console.log(getStringFromWasm0(arg0, arg1));
155};

valtownGeocitiesmain.tsx3 matches

@jamiedubs•Updated 1 year ago
1import { blob } from "https://esm.town/v/std/blob?v=10";
2
3function isJSON(input: string | null | undefined) {
4 if (!input || input === null) return false;
5 try {
11}
12
13function processInputHtml(html: string) {
14 let output = html;
15
21}
22
23function formatPage(key: string, data: string) {
24 return `
25 ${data}

example_rust_valmain.tsx5 matches

@saolsen•Updated 1 year ago
20let cachedUint8Memory0 = null;
21
22function getUint8Memory0() {
23 if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
24 cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
27}
28
29function getStringFromWasm0(ptr, len) {
30 ptr = ptr >>> 0;
31 return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
32}
33/** */
34export const say_hello = (imports.say_hello = function() {
35 wasm.say_hello();
36});
41 * @returns {number}
42 */
43export const add = (imports.add = function(x, y) {
44 const ret = wasm.add(x, y);
45 return ret;
46});
47
48export const __wbg_log_08850d6d4d91f4c9 = (imports.__wbg_log_08850d6d4d91f4c9 = function(arg0, arg1) {
49 console.log(getStringFromWasm0(arg0, arg1));
50});

youtubeEndpointmain.tsx3 matches

@syncretizm•Updated 1 year ago
2import { YouTube } from 'https://deno.land/x/youtube@v0.3.0/mod.ts';
3
4export async function fetchVideoDetails(req) {
5 const url = new URL(req.url);
6 let yturl = url.searchParams.get("yturl") || "";
94 break;
95 case 'transcript':
96 async function fetchcaptions(videoId) {
97 const WATCH_URL = `https://www.youtube.com/watch?v=${videoId}`;
98
135}
136
137function parseISO8601Duration(duration) {
138 const regex = /PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/;
139 const matches = duration.match(regex);

getDetailsPlaystoremain.tsx1 match

@ayrtonlacerda•Updated 1 year ago
1export async function getDetailsPlaystore(request: Request): Promise<Response> {
2 const searchParams = new URL(request.url).searchParams;
3 const bundleId = searchParams.get("bundleId");

checkTensorArtWebStatusmain.tsx2 matches

@lbb00•Updated 1 year ago
2import process from "node:process";
3
4export async function checkTensorArtWebStatus() {
5 async function sendLarkMessage(message) {
6 return fetch(process.env.larkTensorRobotUrl, {
7 method: "POST",

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