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=2669&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"(1753ms)

insecureFetchmain.tsx1 match

@vladimyr•Updated 1 year ago
1export function insecureFetch(input: string | URL | Request, init?: RequestInit) {
2 const origReq = new Request(input, init);
3 const proxyURL = new URL("https://unsecure-fetch.val-town.workers.dev");

signedFetchmain.tsx7 matches

@vladimyr•Updated 1 year ago
11};
12
13export function createSignedFetch(
14 options: SignatureOptions & {
15 fetch?: typeof fetch;
17) {
18 const fetch = options.fetch ?? globalThis.fetch;
19 return async function signedFetch(
20 input: Request | URL | string,
21 init?: RequestInit & Partial<SignatureOptions>,
29}
30
31export async function signRequest(
32 input: Request | URL | string,
33 init: RequestInit & SignatureOptions,
55}
56
57function createMessage(req: Request) {
58 const { pathname, search } = new URL(req.url);
59 const message = Object.entries({
67}
68
69function createSignatureHeader(
70 signature: string,
71 publicKeyId: string | URL,
82}
83
84export async function nodeSign(
85 message: string,
86 privateKey: KeyLike,
98}
99
100export async function webcryptoSign(
101 message: string,
102 privateKey: CryptoKey | string,

prism_feature_notificationsmain.tsx3 matches

@thesephist•Updated 1 year ago
5const confidenceThreshold = 0.8;
6
7function randomlyPickFeature(featuresAboveConfidenceThreshold) {
8 return featuresAboveConfidenceThreshold[Math.floor(Math.random() * featuresAboveConfidenceThreshold.length)];
9}
10
11function getFeatureLink(feature) {
12 const { index } = feature;
13 return `https://thesephist--prism-start-app.modal.run/f/${modelName}/${index}?layout=2`;
14}
15
16export default async function(interval: Interval) {
17 const response = await fetch(dictionaryUrl);
18 const { features } = await response.json();

libmultibasemain.tsx2 matches

@vladimyr•Updated 1 year ago
21} as const;
22
23export function multibaseToBytes(input: string) {
24 const bytes = base58btc.decode(input);
25 const [codec, prefixLength] = varint.decode(bytes);
33}
34
35export function bytesToMultibase(keyBytes: Uint8Array, keyType: string) {
36 const type = KeyType[keyType];
37 if (!type) throw new TypeError("error: unsupported key type");

dailyDadJokemain.tsx1 match

@natekid•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({

invoice_detamain.tsx3 matches

@pomdtr•Updated 1 year ago
136});
137
138function formatDateShort(date) {
139 return date.toLocaleDateString("en-GB", {
140 day: "2-digit",
145}
146
147function formatDateLong(date) {
148 return date.toLocaleDateString("en-US", {
149 year: "numeric",
153}
154
155function addWeeks(date, weeks) {
156 // Create a copy of the date object to avoid modifying the original
157 const newDate = new Date(date.getTime());

tomatoCaterpillarmain.tsx1 match

@qqyule•Updated 1 year ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

oliveMarmotmain.tsx1 match

@generatecoll•Updated 1 year ago
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export default async function() {
4 discordWebhook({
5 url: Deno.env.get("engDiscord"),

renderFormAndSaveDataREADME.md1 match

@generatecoll•Updated 1 year ago
1# Render form and save data
2
3This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data.
4
5Fork this val to customize it and use it on your account.

htmlExamplemain.tsx1 match

@generatecoll•Updated 1 year ago
1// View at https://andreterron-htmlExample.web.val.run?name=Andre
2export default async function(req: Request): Promise<Response> {
3 const query = new URL(req.url).searchParams;
4
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.