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=814&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 8323 results for "function"(446ms)

getPublicKeymain.tsx1 match

@stevekrouse•Updated 1 year ago
1export async function getPublicKey(handle) {
2 let { publicKey } = await import(`/v/${handle}/publicKey`);
3 return publicKey;

runValAPImain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function runValAPI(name, ...args) {
2 return fetch(`https://api.val.town/v1/run/${name.replace("@", "")}`, {
3 method: "POST",

tursomain.tsx1 match

@std•Updated 1 year ago
5type createClient = Awaited<ReturnType<typeof tursoImport>>["createClient"];
6
7export function turso(keys, handle?) {
8 let val = "@std.tursoAPI";
9 let f = (method) => (...args) =>

nodeJSDistmain.tsx1 match

@stevekrouse•Updated 1 year ago
2import LZString from "npm:lz-string";
3
4export async function nodeJSDist(req: Request): Promise<Response> {
5 let url = new URL(req.url);
6 if (url.pathname === "/index.tab") {

pollNodeJSmain.tsx1 match

@stevekrouse•Updated 1 year ago
5const url = "https://nodejs.org/dist/index.tab";
6
7export async function pollNodeJS(interval: Interval) {
8 let resp = await fetch(url);
9 if (!resp.ok) return;

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 })

nearestOpenStationmain.tsx1 match

@tmcw•Updated 1 year ago
4 lon = +lon;
5 lat = +lat;
6 function dist(station) {
7 return Math.sqrt(
8 Math.pow(station.lat - lat, 2) + Math.pow(station.lon - lon, 2)

getDuckDBmain.tsx1 match

@tmcw•Updated 1 year ago
2
3export let getDuckDB = (async () => {
4 async function createWorker(url: string) {
5 const workerScript = await fetch(url);
6 const workerURL = URL.createObjectURL(await workerScript.blob());

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago