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/$%7Burl%7D?q=function&page=2077&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 22487 results for "function"(2819ms)

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

untitled_ivoryFishmain.tsx1 match

@bryanb9•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

tracingREADME.md2 matches

@saolsen•Updated 1 year ago
2
3Enables Opentelemetry tracing for vals.
4Exports two functions, `init` and `traced_handler`.
5`init` will set up opentelemetry.
6
10In the future we can add more export targets for other services. I'm also thinking about making a val to display them.
11
12`traced_handler` is a wrapper for your handler you can use on an HTTP val. Just pass it your HTTP function and export it as the default and it'll trace every request.
13
14Here's a screenshot of what the honeycomb view of a trace from my [connect playing val](https://www.val.town/v/saolsen/connect4_site) looks like.

clerk_hono_pocmain.tsx3 matches

@saolsen•Updated 1 year ago
13const app = new Hono();
14
15function main(children: Child): JSX.Element {
16 return (
17 <main id="main">
21}
22
23function page(children: Child): JSX.Element {
24 return (
25 <html>
33 {html`
34 <script>
35 async function loadClerk() {
36 await window.Clerk.load()
37 if (window.Clerk.user) {

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
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.