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=2641&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 29089 results for "function"(1776ms)

compileAndUploadTinygoWasmmain.tsx1 match

@maxm•Updated 1 year ago
59const resp = await fetch("${url}");
60const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
61export default async function(req: Request): Promise<Response> {
62 return handler(req);
63}`);

translatormain.tsx2 matches

@stevekrouse•Updated 1 year ago
348
349
350 // Helper function to get the supported MIME type
351 function getSupportedMimeType() {
352 const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
353 const mimeTypes = [

homelessmain.tsx4 matches

@cameronpak•Updated 1 year ago
81 * @return {number} the distance in miles
82 */
83function convertMetersToMiles(meters: number): number {
84 return 0.000621371 * meters;
85}
86
87// Round a number to the nearest quarter.
88function roundToQuarter(number: number) {
89 let remainder = number % 1;
90
114 * @return {SearchParams | SearchParamsWithPreset} The constructed search parameters.
115 */
116function constructTypesenseParams({
117 query,
118 lat,
158 * @return {Promise<any>} A Promise that resolves to an array of resources matching the search criteria.
159 */
160export async function getResources({
161 lat,
162 lng,

tinygoWasmHelloWorldmain.tsx1 match

@maxm•Updated 1 year ago
2const resp = await fetch("https://maxm-wasmBlobHost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
3const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
4export default async function(req: Request): Promise<Response> {
5 return handler(req);
6}

wasmBlobHostmain.tsx7 matches

@maxm•Updated 1 year ago
10const WASM_BLOB_PREFIX = `${author}-${name}-wasm-wasm-blob-v1-`;
11
12async function readAllBytes(stream: ReadableStream<Uint8Array>): Promise<Buffer> {
13 const reader = stream.getReader();
14 const chunks: Uint8Array[] = [];
25}
26
27function getSha256Hash(buffer: Buffer): string {
28 return base32Encode(
29 createHash("sha256").update(buffer).digest().slice(0, 20),
32 ).toLowerCase();
33}
34function trimPrefix(str, prefix) {
35 if (str.startsWith(prefix)) {
36 return str.slice(prefix.length);
38 return str;
39}
40function trimSuffix(str, suffix) {
41 if (str.endsWith(suffix)) {
42 return str.slice(0, -suffix.length);
52};
53
54function formatBytes(bytes: number): string {
55 if (bytes === 0) return "0B";
56
64}
65
66function relativeTimeFromNow(dateString: string): string {
67 const now = new Date();
68 const date = new Date(dateString);
83}
84
85export default async function(req: Request): Promise<Response> {
86 if (req.method === "POST") {
87 const body = await readAllBytes(req.body);

compileAndUploadTinygoWasmREADME.md1 match

@maxm•Updated 1 year ago
36const resp = await fetch("https://maxm-wasmBlobHost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
37const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
38export default async function(req: Request): Promise<Response> {
39 return handler(req);
40}

tinygoHttpmain.tsx5 matches

@maxm•Updated 1 year ago
40}
41
42function callHandlerWithString(
43 instance: WebAssembly.Instance,
44 payload: string,
47 return callHandlerWithBytes(instance, bytes);
48}
49function callHandlerWithJson(instance: WebAssembly.Instance, payload: any) {
50 const bytes = new TextEncoder("utf8").encode(JSON.stringify(payload));
51 return callHandlerWithBytes(instance, bytes);
54const MASK = 2n ** 32n - 1n;
55
56function callHandlerWithBytes(
57 instance: WebAssembly.Instance,
58 bytes: Uint8Array,
88}
89
90async function handleRequest(
91 instance: WebAssembly.Instance,
92 req: Request,
108}
109
110export async function wasmHandler(wasmBytes: Uint8Array): Promise<(Request) => Promise<Response>> {
111 const init = async (wasmBytes: Uint8Array) => {
112 const context = new Context({ args: [], env: Deno.env.toObject() });

generateBubblesmain.tsx1 match

@iamseeley•Updated 1 year ago
1export function generateBubbles() {
2 let bubbles = '';
3 for (let i = 0; i < 30; i++) {

QuillEditormain.tsx3 matches

@stevekrouse•Updated 1 year ago
2import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
3
4export default async function(req: Request) {
5 const url = new URL(req.url);
6 const name = url.pathname.slice(1);
63 let quill = new Quill('#editor', options)
64
65 function save() {
66 return fetch('${thisWebURL()}/${name}', {
67 method: 'POST',
76 const saveStatus = document.getElementById('save-status');
77 quill.on('text-change', debounce(
78 async function(delta, oldDelta, source) {
79 saveStatus.innerHTML = 'Saving...';
80 await save();

wasmBlobHostmain.tsx4 matches

@tmcw•Updated 1 year ago
9const WASM_BLOB_PREFIX = `${author}-${name}-wasm-wasm-blob`;
10
11async function readAllBytes(stream: ReadableStream<Uint8Array>): Promise<Buffer> {
12 const reader = stream.getReader();
13 const chunks: Uint8Array[] = [];
24}
25
26function getSha256Hash(buffer: Buffer): string {
27 const hash = createHash("sha256");
28 hash.update(buffer);
29 return hash.digest("hex");
30}
31function trimPrefix(str, prefix) {
32 if (str.startsWith(prefix)) {
33 return str.slice(prefix.length);
39};
40
41export default async function(req: Request): Promise<Response> {
42 if (req.method === "POST") {
43 const body = await readAllBytes(req.body);
tuna

tuna9 file matches

@jxnblk•Updated 23 hours 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.