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=2764&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 29089 results for "function"(1783ms)

setCookiemain.tsx1 match

@tmcw•Updated 1 year ago
5
6/** Set a cookie and keep track of it inflight */
7export function setCookie(c: Context, key: string, value: string) {
8 const inflight = getInflight(c);
9 inflight.set(key, value);

getInflightmain.tsx1 match

@tmcw•Updated 1 year ago
2import { Context } from "npm:hono@3.8.1";
3
4export function getInflight(c: Context) {
5 return InflightCookies.get(c) || new Map();
6}

formatFloatmain.tsx1 match

@tmcw•Updated 1 year ago
24
25// TODO: refactor
26export function formatFloat(a: number) {
27 const intPart = Math.floor(a);
28 const remainder = Math.floor((a - intPart) * 100);

blogREADME.md1 match

@pomdtr•Updated 1 year ago
17import { html } from "https://esm.town/v/stevekrouse/html?v=5";
18
19export async function examplePost(req: Request) {
20 const { author, name } = extractValInfo(import.meta.url);
21 return html(await article(author, name));

emailRandomJokemain.tsx1 match

@gab0503•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

emailRandomJokemain.tsx1 match

@linafu2•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

emailRandomJokemain.tsx1 match

@tylerbinns•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

setTempmain.tsx1 match

@cufaoil•Updated 1 year ago
2import { set } from "https://esm.town/v/std/set?v=11";
3
4export async function setTemp(temp: Request) {
5 const currentDate = new Date();
6 const timestamp = currentDate.getTime();

untitled_amethystStorkmain.tsx1 match

@cufaoil•Updated 1 year ago
1export async function untitled_amethystStork(request: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

htmlREADME.md1 match

@lbb00•Updated 1 year ago
1# Render html by tagged templates
2
3You can use this simple function to compose components, and you can also format the content within html`` elegantly in VSCode.
4
5## Example
tuna

tuna9 file matches

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