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=2149&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 22865 results for "function"(1607ms)

parse_cookiesREADME.md1 match

@mattx•Updated 1 year ago
2Parses Cookie headers into objects.
3- `jar`: Value of the Cookie header
4- `decoder`: Function to run on all cookie names and values. This is to get around character limitations (see [RFC 6265](https://httpwg.org/specs/rfc6265.html#rfc.section.4.1.1)). There is no formal standard, but as most sites prefer URL encoding, it is the default. `x => x` can be used as a way to disable decoding.
5
6Migrated from folder: loginable_demo/parse_cookies

valSignmain.tsx1 match

@easrng•Updated 1 year ago
2import { Buffer } from "node:buffer";
3
4export async function valSign({ keys, data, expireIn }: {
5 keys: {
6 publicKey: string;

valSignVerifymain.tsx1 match

@easrng•Updated 1 year ago
1import { Buffer } from "node:buffer";
2
3export async function valSignVerify(encoded: string) {
4 const matches = (encoded + "").match(/^@([^\.]+)\.(.+)$/);
5 if (!matches)

generateKeysmain.tsx1 match

@easrng•Updated 1 year ago
1import { Buffer } from "node:buffer";
2
3export async function generateKeys() {
4 const { default: nacl } = await import("npm:tweetnacl@1.0.3");
5 const keyPair = nacl.sign.keyPair();

imageUrlToBase64main.tsx1 match

@andreterron•Updated 1 year ago
1import { Buffer } from "node:buffer";
2
3export async function imageUrlToBase64(res: Response) {
4 // From https://stackoverflow.com/a/60321567
5 const buffer = Buffer.from(await res.arrayBuffer());

pollRSSFeedsmain.tsx1 match

@iakovos•Updated 1 year ago
4import { rssFeeds } from "https://esm.town/v/iakovos/rssFeeds";
5
6export async function pollRSSFeeds() {
7 let allNewItems = [];
8 const rssFeedChunks = chunk2(rssFeeds, 25);

renderFeedsForEmailmain.tsx1 match

@iakovos•Updated 1 year ago
1import { generateFeedHTML } from "https://esm.town/v/iakovos/generateFeedHTML";
2
3export function renderFeedsForEmail(feeds) {
4 let html = `
5<!DOCTYPE html>

getValREADME.md1 match

@stevekrouse•Updated 1 year ago
2Gets information about a specific val.
3
4To access private vals, pass your API token as a secret to the function. Read more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token and save it as a secret.
5
6Migrated from folder: Archive/getVal

parsePacoExmain.tsx1 match

@stevekrouse•Updated 1 year ago
3export const parsePacoEx = (async () => {
4 var pako = await import("npm:pako");
5 function decodeMermaid(encodedString) {
6 var binaryData = Buffer.from(encodedString, "base64");
7 var inflatedString = pako.inflate(binaryData, { to: "string" });

qrmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { Buffer } from "node:buffer";
2
3export async function qr(req: express.Request, res: express.Response) {
4 if (req.path.startsWith("/qr")) {
5 const { qrcode } = await import("https://deno.land/x/qrcode/mod.ts");
20 let img = document.getElementsByTagName("img")[0]
21 let input = document.getElementsByTagName("input")[0]
22 input.addEventListener('input', function(e){
23 img.src="/qr?data=" + e.target.value
24 })

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.