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=2698&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"(1825ms)

todomain.tsx1 match

@pomdtr•Updated 1 year ago
4import { html } from "https://esm.town/v/stevekrouse/html?v=5";
5
6async function handler(req: Request) {
7 const { data: vals } = await api(`/v1/search/vals?query=${encodeURIComponent("- [ ]")}`);
8

countermain.tsx1 match

@pomdtr•Updated 1 year ago
7};
8
9export default function Counter(props: Props) {
10 const [count, setCount] = useState(props.initialCount || 0);
11

mdToHtmlmain.tsx1 match

@agmm•Updated 1 year ago
1import { render } from "https://esm.town/v/ije/md?v=2";
2
3export default async function(req: Request): Promise<Response> {
4 const markdown = `
5 # Title

mdmain.tsx1 match

@ije•Updated 1 year ago
3await init("small");
4
5export function render(html: string) {
6 return mdToHtml(html);
7}

teapotmain.tsx1 match

@agmm•Updated 1 year ago
1export default async function(req: Request): Promise<Response> {
2 const statusDoc = "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418";
3 const text = `I am a teapot 🫖\n\n${statusDoc}`;

postEvalmain.tsx3 matches

@vladimyr•Updated 1 year ago
4import { fetchTweet } from "https://esm.town/v/vladimyr/fetchTweet";
5
6export default async function(req: Request): Promise<Response> {
7 const reqURL = new URL(req.url);
8 const query = reqURL.pathname.slice(1);
22}
23
24export async function postEval(post, args?) {
25 const code = post.text.split("```")[1]
26 .trim()
31}
32
33export async function fetchPost(url: string | URL) {
34 const postURL = new URL(url);
35 if (["x.com", "twitter.com"].includes(postURL.hostname)) {

provideBlobmain.tsx5 matches

@postpostscript•Updated 1 year ago
6export const DEFAULT_PREFIX = `${getValNameFromUrl(import.meta.url)}:`;
7
8export async function poll(url = URL, { initialDelay = 1000, tries = 10, retryMs = 1000, log = true }) {
9 for (let i = 0; i < tries; i++) {
10 try {
27}
28
29export function provideBlob(getValue: (() => Promise<any> | any) | Promise<any>, prefix = DEFAULT_PREFIX) {
30 const id = crypto.randomUUID();
31
54 // https://stackoverflow.com/a/9899701
55 // licence: CC BY-SA 4.0
56 function docReady(fn) {
57 if (document.readyState === "complete" || document.readyState === "interactive") {
58 setTimeout(fn, 1);
103}
104
105export async function getProvidedBlob(id: string, deleteOnSuccess = true, prefix = DEFAULT_PREFIX) {
106 const name = `${prefix}${id}`;
107 const value = await blob.get(name);
110}
111
112export default async function(req: Request) {
113 if (req.method === "OPTIONS") {
114 return new Response("OK", {

provideBlobExamplemain.tsx1 match

@postpostscript•Updated 1 year ago
5import { provideBlob } from "https://esm.town/v/postpostscript/provideBlob";
6
7export default async function(req: Request): Promise<Response> {
8 const expensiveContent = provideBlob(async () => {
9 await delay(2000 + Math.random() * 3000);

provideBlobREADME.md1 match

@postpostscript•Updated 1 year ago
10import { provideBlob } from "https://esm.town/v/postpostscript/provideBlob";
11
12export default async function(req: Request) {
13 const image = provideBlob(async () => {
14 const png = new Image(100, 100);

blobmanagermain.tsx1 match

@agmm•Updated 1 year ago
6const app = new Hono();
7
8function getValUrl() {
9 const val = rootRef();
10 return `https://${val.userHandle}-${val.valName}.web.val.run`;
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.