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=2711&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 28743 results for "function"(3794ms)

applePodcastmain.tsx2 matches

@vladimyr•Updated 1 year ago
1export function isApplePodcast(podcastURL: URL | string) {
2 try {
3 podcastURL = new URL(podcastURL);
9}
10
11export function getItunesId(podcastURL: URL | string) {
12 try {
13 podcastURL = new URL(podcastURL);

podnewsmain.tsx2 matches

@vladimyr•Updated 1 year ago
6const isString = (arg): arg is string => typeof arg === "string";
7
8export async function getPodnewsId(podcastId: string) {
9 // https://podnews.net/podcast/subscribe-pages
10 const redirectURL = new URL(`/podcast/${podcastId}`, BASE_URL);
24type PodcastInfo = { podcastId: string } | { podnewsId: string };
25
26export async function getFeedUrl(podcastInfo: PodcastInfo) {
27 let podnewsId;
28 if ("podnewsId" in podcastInfo) {

podcastmain.tsx2 matches

@vladimyr•Updated 1 year ago
1import { parseFeed } from "https://deno.land/x/rss@1.0.0/mod.ts";
2
3export async function getLastEpisode(xml: string) {
4 const { entries } = await parseFeed(xml);
5 return entries
8}
9
10export async function getLastPubDate(xml: string) {
11 const lastEpisode = await getLastEpisode(xml);
12 return lastEpisode.published;

handleGroupmeMessagemain.tsx1 match

@tjnoe•Updated 1 year ago
2import process from "node:process";
3
4export async function handleGroupmeMessage(
5 req: express.Request,
6 res: express.Response,

testFilteringCommentsValmain.tsx4 matches

@willthereader•Updated 1 year ago
6// File: TestFilteringCommentsVal.js
7export const testFilteringCommentsVal = (() => {
8 const innerAsyncFunction = async () => {
9 logMessage("debug", "Initialization of innerAsyncFunction");
10 const lastRunAt = new Date("2013-10-14T16:07:01.000Z");
11 // Construct the URL with the desired parameters
41 );
42 }
43 return filteredComments; // Return the filtered comments from innerAsyncFunction
44 };
45 return innerAsyncFunction();
46})();

aoc15_06main.tsx5 matches

@karfau•Updated 1 year ago
6// expect(firstStar(``), "*1 sample 2").to.equal("?");
7
8function firstStar(input: string) {
9 return "expected output"; // implement :)
10}
14expect(secondStar(``), "*2 sample 1").to.equal("?");
15// expect(secondStar(``), "*1 sample 2").to.equal("?");
16function secondStar(input: string) {
17 return "?";
18}
19console.log("solution *2:", secondStar(input()));
20
21function input() {
22 return `turn on 887,9 through 959,629
23turn on 454,398 through 844,448
323
324// [0,1,2,3].reduce(sum, 0) => 6
325function sum(sum: number, current: number) {
326 return sum + current;
327}
328// wrap a value to print and return it
329function debug<T>(value: T, msg = "debug"): T {
330 console.log(msg, value);
331 return value;

untitled_blackBeemain.tsx2 matches

@boucher•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) =>
21}
22
23export const endpoint = function(req, res) {
24 res.end("hello, world!");
25};

untitled_blackBeeREADME.md2 matches

@boucher•Updated 1 year ago
171. [Generate your keypair](https://www.val.town/embed/new?code=import+%7B+set+%7D+from+%22https%3A%2F%2Fesm.town%2Fv%2Fstd%2Fset%22%3B%0Aimport+%7B+generateKeys+%7D+from+%22https%3A%2F%2Fesm.town%2Fv%2Fstevekrouse%2FgenerateKeys%22%3B%0A%0Alet+keys+%3D+await+generateKeys%28%29%0A%0Aexport+let+exportedKeySetter+%3D+Promise.all%28%5B%0A++set%28%22exportedKeys%22%2C+keys%29%2C%0A++set%28%22publicKey%22%2C+keys.publicKey%29%0A%5D%29)
182. On [your publicKey](https://www.val.town/v/me/publicKey) click the lock icon🔒 to change the permissions to `Unlisted`.
193. [Fork this helper function](https://www.val.town/v/stevekrouse.turso/fork) replacing `stevekrouse` with your own username
204. [Try out some queries!](https://www.val.town/v/stevekrouse.tursoExamples/fork)
21
35## Architecture
36
37This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication, creates databases, and forwards on your SQL queries. You can get lower latency (~200ms vs ~800ms), more storage, databases, CLI & API access by having your own Turso account.

untitled_aquaBirdmain.tsx1 match

@pdlieber•Updated 1 year ago
2
3// Fetches a random joke.
4function fetchRandomJoke() {
5 const SAMPLE_JOKE = {
6 "setup": "What do you call a group of disorganized cats?",

untitled_limeBeetlemain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { refs } from "https://esm.town/v/stevekrouse/refs";
2
3function a() {
4 console.log(refs());
5}

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.