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=1430&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 18628 results for "function"(4086ms)

tvshowsmain.tsx2 matches

@tmcw•Updated 7 months ago
3import process from "node:process"
4
5export const tvshows = async function() {
6 const TV_SHOWS_WATCHED = [
7 // Ted Lasso
32 data.push(show)
33 }
34 data.sort(function(a, b) {
35 if (a.last_air_date > b.last_air_date)
36 return -1

getAppleDevicemain.tsx1 match

@tmcw•Updated 7 months ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5"
2
3export async function getAppleDevice(req: Request) {
4 const deviceId = new URL(req.url).searchParams.get("search_keywords") as string
5 if (!deviceId) return Response.json("Please provide a search_keywords query parameter")

replaceEmojisWithImagesmain.tsx1 match

@tmcw•Updated 7 months ago
1export async function replaceEmojisWithImages(
2 req: express.Request,
3 res: express.Response,

hiraganaWordBuildermain.tsx4 matches

@ashryanio•Updated 7 months ago
54};
55
56function HiraganaWordBuilder() {
57 const [currentWord, setCurrentWord] = useState({ romaji: "", hiragana: "" });
58 const [userInput, setUserInput] = useState([]);
245}
246
247function App() {
248 return (
249 <div className="min-h-screen bg-gray-100 py-6 flex flex-col justify-center sm:py-12">
255}
256
257function client() {
258 createRoot(document.getElementById("root")).render(<App />);
259}
261if (typeof document !== "undefined") { client(); }
262
263export default async function server(request: Request): Promise<Response> {
264 const url = new URL(request.url);
265

scholarlyIvoryWombatmain.tsx3 matches

@stevekrouse•Updated 7 months ago
5
6const MODELS = ["llama3.1-8b", "llama3.1-70b"];
7function App() {
8 const [messages, setMessages] = useState<Array<{ role: string; content: string }>>([]);
9 const [edits, setEdits] = useState<Array<{ id: number; content: string }>>(
125}
126
127function client() {
128 createRoot(document.getElementById("root")).render(<App />);
129}
133}
134
135async function server(request: Request): Promise<Response> {
136 if (request.method === "POST" && new URL(request.url).pathname === "/api/chat") {
137 const { messages, model } = await request.json();

weatherGPTmain.tsx1 match

@tnordby•Updated 7 months ago
31console.log(text);
32
33export async function weatherGPT() {
34 await email({ subject: "Weather Today", text });
35}

dobbymain.tsx2 matches

@yawnxyz•Updated 7 months ago
414}
415
416// New standalone function to drop any database
417export async function dropDatabase(dbName: string): Promise<void> {
418 try {
419 await sqlite.execute(`DROP TABLE IF EXISTS ${dbName}`);

debatePollAppmain.tsx3 matches

@laur3n•Updated 7 months ago
4import Chart from "https://esm.sh/chart.js/auto";
5
6function App() {
7 const [polls, setPolls] = useState([]);
8 const [newPollQuestion, setNewPollQuestion] = useState("");
142}
143
144function client() {
145 createRoot(document.getElementById("root")).render(<App />);
146}
147if (typeof document !== "undefined") { client(); }
148
149export default async function server(request: Request): Promise<Response> {
150 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
151 const SCHEMA_VERSION = 1

SimpleAdditionmain.tsx3 matches

@efoley•Updated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [num1, setNum1] = useState(0);
7 const [num2, setNum2] = useState(0);
93}
94
95function client() {
96 createRoot(document.getElementById("root")).render(<App />);
97}
101}
102
103export default async function server(request: Request): Promise<Response> {
104 return new Response(
105 `

btcPriceAlertmain.tsx1 match

@workingpleasewait•Updated 7 months ago
4import { currency } from "https://esm.town/v/stevekrouse/currency";
5
6export async function btcPriceAlert() {
7 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8 let btcPrice = await currency("usd", "btc");

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
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",