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=1450&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 19016 results for "function"(2281ms)

aqimain.tsx1 match

@jessicatheodosius•Updated 6 months ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "downtown brooklyn"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

instantdbReactionsExamplemain.tsx6 matches

@vawogbemi•Updated 6 months ago
37 "rounded-lg bg-white p-3 text-3xl shadow-lg transition duration-200 ease-in-out hover:-translate-y-1 hover:shadow-xl";
38
39function animateEmoji(
40 config: { emoji: string; directionAngle: number; rotationAngle: number },
41 target: HTMLDivElement | null,
80}
81
82function style(el: HTMLElement, styles: Partial<CSSStyleDeclaration>) {
83 Object.assign(el.style, styles);
84}
85
86function InstantTopics() {
87 const db = init({
88 appId: "25280469-70aa-4c6e-9d47-be46e0bca539", // Replace with your actual InstantDB app ID
140}
141
142function App() {
143 return <InstantTopics />;
144}
145
146function client() {
147 createRoot(document.getElementById("root")!).render(<App />);
148}
152}
153
154export default async function server(request: Request): Promise<Response> {
155 return new Response(
156 `

simpletypemain.tsx3 matches

@dantaloupe•Updated 6 months ago
5const symbols = "!@#$%^&*()_+-=[]{}|;:,.<>?`~";
6
7function App() {
8 const [gameMode, setGameMode] = useState("words");
9 const [challenge, setChallenge] = useState("");
151}
152
153function client() {
154 createRoot(document.getElementById("root")).render(<App />);
155}
159}
160
161export default async function server(request: Request): Promise<Response> {
162 return new Response(`
163 <!DOCTYPE html>

svaltownmain.tsx4 matches

@vprtwn•Updated 6 months ago
36const TAB_UNICODE = "⇥"; // Unicode character for tab
37
38function formatTime(seconds: number): string {
39 const hrs = Math.floor(seconds / 3600);
40 const mins = Math.floor((seconds % 3600) / 60);
43}
44
45function App() {
46 const [currentWords, setCurrentWords] = useState("");
47 const [userInput, setUserInput] = useState("");
379}
380
381function client() {
382 createRoot(document.getElementById("root")).render(<App />);
383}
387}
388
389export default async function server(request: Request): Promise<Response> {
390 const url = new URL(request.url);
391

startup_clickermain.tsx4 matches

@jaredsilver•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [gameState, setGameState] = useState({
7 specs: 0,
287}
288
289function Store({ hireProductManager, hireSoftwareEngineer, hireDirectorOfProduct, hireDirectorOfEngineering, hireVPOfProduct, hireVPOfEngineering, runHomePageABTest, runPaywallABTest, productManagers, softwareEngineers, directorOfProduct, directorOfEngineering, vpOfProduct, vpOfEngineering, homePageABTests, paywallABTests, homePageABTestCost, paywallABTestCost, dollars }) {
290 const [activeTab, setActiveTab] = useState('recruit');
291
376}
377
378function client() {
379 createRoot(document.getElementById("root")).render(<App />);
380}
381if (typeof document !== "undefined") { client(); }
382
383export default async function server(request: Request): Promise<Response> {
384 return new Response(`
385 <html>

cabinTwitterSearchmain.tsx1 match

@jonbo•Updated 6 months ago
3import { twitterUser } from "https://esm.town/v/stevekrouse/twitterUser";
4
5export async function twitterSearch({
6 query,
7 start_time,

uptimemain.tsx1 match

@jongreer•Updated 6 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let reason: string, status: number, end: number;
10 let ok = true;

sqliteExplorerAppREADME.md1 match

@braedennorris•Updated 6 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

ZineFairsmain.tsx4 matches

@sylvea•Updated 6 months ago
12
13// Scrapes the stencil fairs website and gets the upcoming events
14async function scrapeWebsiteAndGetEvents(url: string): Promise<Array<Event>> {
15 const response = await fetch(url);
16 if (!response.ok) {
44
45// Checks whether a given event already exists in the database
46async function doesEventExist(eventName: string): Promise<boolean> {
47 const result = await sqlite.execute({
48 sql: `select * from stencil_fairs where name = :eventName`,
52}
53
54// This is the function that is called via the Cron job
55// It gets all the upcoming events from the website
56// Then it checks if there are any new ones by checking whether all the upcoming events are already in our db
57// If there are any new ones, it saves them to the db and sends a notification email
58export default async function(interval: Interval) {
59 try {
60 const upcomingEvents = await scrapeWebsiteAndGetEvents(WEBSITE_URL);

flutteringVioletBirdmain.tsx4 matches

@stevekrouse•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [description, setDescription] = useState("Thu, Sep 26, 2024 2:25 PM EDT");
7 const [dateString, setDateString] = useState("2024-09-26T14:25:00-04:00");
77}
78
79function DateComponent({ dateString }) {
80 if (!dateString) {
81 return <div>Invalid date string provided</div>;
107);
108
109function client() {
110 createRoot(document.getElementById("root")).render(<App />);
111}
115}
116
117export default async function server(request: Request): Promise<Response> {
118 return new Response(`
119 <!DOCTYPE html>

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": "*",