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=2616&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 28936 results for "function"(2482ms)

biomain.tsx1 match

@triptych•Updated 1 year ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

aqimain.tsx1 match

@adrianlee•Updated 1 year ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "japanese prespretarian church, seattle, wa, 98144"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

twitterAlertmain.tsx1 match

@kristencheung•Updated 1 year ago
4const query = "\"val.town\" OR \"val town\" -_ValTown_";
5
6export async function twitterAlert({ lastRunAt }: Interval) {
7 const results = await twitterSearch({
8 query,

openAIStreamingmain.tsx1 match

@maxm•Updated 1 year ago
19const messages = ["What should I build today?", "Very cool. Can you make it even cooler?"];
20
21export default async function(req: Request): Promise<Response> {
22 const url = new URL(req.url);
23 if (url.pathname === "/favicon.ico") {

greenPeafowlmain.tsx2 matches

@ravvi_kumar•Updated 1 year ago
29const asyncProgram = Effect.promise(() => Promise.resolve(42));
30
31// just like functions, effects themselves are just values
32// they don't do anything until you 'run' them
33
65// });
66
67// as an alternative to simply throwing the error, the run*Exit functions
68// provide a `Exit` type that represents either a success or a number of possible failure types
69

streamingResponseExamplemain.tsx1 match

@maxm•Updated 1 year ago
1import { getRandomEmoji } from "https://esm.town/v/maxm/getRandomEmoji";
2
3export default async function(req: Request): Promise<Response> {
4 let timer: number | undefined = undefined;
5 const body = new ReadableStream({

getRandomEmojimain.tsx1 match

@maxm•Updated 1 year ago
1import emojis from "https://esm.sh/emojis-list";
2export function getRandomEmoji(): string {
3 return emojis[Math.floor(Math.random() * emojis.length)];
4}

reacttldrawclientmain.tsx1 match

@tfayyaz•Updated 1 year ago
7// import "https://esm.sh/tldraw/tldraw.css";
8
9export function App() {
10 return (
11 <>

openAIStreamingREADME.md1 match

@maxm•Updated 1 year ago
121. **Random Joke Generator:** Fetch a random joke from an API and display it.
132. **Daily Weather Update:** Pull weather data for your location using an API and create a daily summary.
143. **Mini Todo List:** Create a simple to-do list app with add, edit, and delete functionalities.
154. **Chuck Norris Facts:** Display a random Chuck Norris fact sourced from an API.
165. **Motivational Quote of the Day:** Fetch and display a random motivational quote each day.

lastloginHonomain.tsx1 match

@pomdtr•Updated 1 year ago
2import type { MiddlewareHandler } from "npm:hono";
3
4export function lastlogin(options?: LastLoginOptions): MiddlewareHandler {
5 return async (c, next) => {
6 return lastlogin2(next, options)(c.req.raw);
tuna

tuna9 file matches

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