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=1573&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 18465 results for "function"(4268ms)

sqlite_admin_tablemain.tsx1 match

@todepond•Updated 11 months ago
3import { css } from "https://esm.town/v/stevekrouse/sqlite_admin_css";
4
5export async function sqlite_admin_table(name: string) {
6 if (!name.match(/^[A-Za-z_][A-Za-z0-9_]*$/)) return <>Invalid table name</>;
7 let data = await sqlite.execute(`SELECT * FROM ${name}`);

booksmain.tsx2 matches

@laidlaw•Updated 11 months ago
7const openai = new OpenAI();
8
9function esmTown(url) {
10 return fetch(url, {
11 headers: {
92});
93
94export async function getBooks(file: File) {
95 const dataURL = await fileToDataURL(file);
96 try {

ideasmain.tsx1 match

@stevekrouse•Updated 11 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}
2import { Context, Hono } from "npm:hono";
3
4// Define the route handler function
5export const Time_Blindness_Loud_Calendar_via_iOS_shortcuts = (c: Context) => {
6 console.log("Route accessed: Time_Blindness_Loud_Calendar_via_iOS_shortcuts");

key_safe_linkmain.tsx1 match

@stevekrouse•Updated 11 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

favFarmmain.tsx1 match

@stevekrouse•Updated 11 months ago
81 dangerouslySetInnerHTML={{
82 __html: `
83 function copyToClipboard(codeEl) {
84 navigator.clipboard.writeText(codeEl.innerText);
85 codeEl.classList.add('hl');

weatherGPTmain.tsx1 match

@jcoleman•Updated 11 months ago
38console.log(text);
39
40export async function weatherGPT() {
41 await email({ subject: "Weather Today", text });
42}

preactExamplemain.tsx2 matches

@tfayyaz•Updated 11 months ago
3import { render } from "npm:preact-render-to-string";
4
5function Car(props) {
6 return <h2>Hi, I am a {props.color} component Car!</h2>;
7}
8
9function Garage() {
10 return (
11 <>

aiImageExamplemain.tsx3 matches

@yawnxyz•Updated 11 months ago
2import { z } from "npm:zod";
3
4// Function to handle image and text input using OpenAI's GPT-4-turbo
5async function handleImageChat() {
6 const initialMessages = [
7 { role: "system", content: "You are a helpful assistant." },
30}
31
32// Run the function
33await handleImageChat();
34

easyAQImain.tsx1 match

@stevekrouse•Updated 11 months ago
7const cacheKey = location => "easyAQI_locationID_cache_" + encodeURIComponent(location);
8
9export async function easyAQI({ location }: {
10 location: string;
11}) {

getFileEmail4 file matches

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

tuna8 file matches

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