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/$%7Bsuccess?q=function&page=1741&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 19265 results for "function"(1152ms)

copy_val_slugmain.tsx1 match

@pomdtr•Updated 1 year ago
2import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
3
4export default async function ({ url }: BrowserContext) {
5 const { author, name } = extractValInfo(url);
6 await navigator.clipboard.writeText(`${author}/${name}`);

svgMapOfCountrymain.tsx2 matches

@jdan•Updated 1 year ago
2import { blob } from "https://esm.town/v/std/blob?v=10";
3
4export async function svgMapOfCountry(country: string) {
5 const mapUrl = (await countryData())
6 .find((value) => value.countryLabel === country)
63 let svgString = `<svg viewBox="${viewBox}" xmlns="http://www.w3.org/2000/svg">\n`;
64
65 // Function to convert a ring to a path data string
66 const ringToPathD = (ring) => {
67 let d = `M ${ring[0][0]} ${90 - ring[0][1]} `;

countryDatamain.tsx1 match

@jdan•Updated 1 year ago
11const CACHE_KEY = "cache-jdan/countryData";
12
13export async function countryData(): Promise<Entry[]> {
14 const cached = await blob.getJSON(CACHE_KEY);
15 if (cached) {

sparqlmain.tsx1 match

@jdan•Updated 1 year ago
1export async function sparql(query) {
2 const url = `https://query.wikidata.org/sparql?query=${encodeURIComponent(query)}`;
3 const res = await fetch(url, {

dbToAPImain.tsx1 match

@nbbaier•Updated 1 year ago
6
7// TODO: implement options
8export async function createServer(db, options: Options & { auth?: { username: string; password: string } } = {}) {
9 const app = new Hono();
10

inTheBackgroundExamplemain.tsx1 match

@neverstew•Updated 1 year ago
2import { sleep } from "https://esm.town/v/neverstew/sleep";
3
4export default async function(req: Request): Promise<Response> {
5 inTheBackground(async () => {
6 await sleep(3000);

earlyWebReturnmain.tsx2 matches

@neverstew•Updated 1 year ago
1export default async function(req: Request): Promise<Response> {
2 logTimeLater();
3 return Response.json({ time: new Date() });
4}
5
6async function logTimeLater() {
7 await new Promise((resolve) => {
8 setTimeout(() => {

sendNewsletterRemindermain.tsx1 match

@petermillspaugh•Updated 1 year ago
2import { email } from "https://esm.town/v/std/email?v=11";
3
4export async function sendNewsletterReminder(interval: Interval) {
5 // await email({
6 // subject: `Reminder to prepare newsletter #${newsletters.length + 1}`,

sendNewsletterReminderREADME.md1 match

@petermillspaugh•Updated 1 year ago
3Cousin Val to [@petermillspaugh/emailSubscription](https://www.val.town/v/petermillspaugh/emailSubscription) for emailing yourself a reminder to send your next newsletter.
4
5Since this Val is public, anyone can run it. I've commented out the function body that actually emails me to prevent anyone from spamming me, but you can fork this as a private Val to set a cron reminder.
6
7Migrated from folder: EmailSubscriptions/sendNewsletterReminder

emailSubscriptionmain.tsx1 match

@petermillspaugh•Updated 1 year ago
7import { Hono } from "npm:hono";
8
9export async function emailSubscription(req: Request) {
10 const app = new Hono();
11

getFileEmail4 file matches

@shouser•Updated 2 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 weeks 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.