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=1383&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 18949 results for "function"(2991ms)

TaylorSwiftMomentsmain.tsx7 matches

@vawogbemi•Updated 5 months ago
84];
85
86function Header({ logoUrl, themeColor1, themeColor2 }) {
87 return (
88 <div className="py-4" style={{ backgroundColor: themeColor1, color: themeColor2 }}>
96}
97
98function EraSelector({ activeEra, onSelectEra }) {
99 return (
100 <div className="flex justify-center items-stretch w-full h-[40vh] overflow-hidden">
125}
126
127function truncatePrompt(prompt, maxLength = 50) {
128 if (prompt.length <= maxLength) return prompt;
129 return prompt.substring(0, maxLength - 3) + "...";
130}
131
132function ImageGallery({ images, activeEra, onLike, onDelete }) {
133 const downloadImage = async (url, filename) => {
134 try {
193}
194
195function App() {
196 const [prompt, setPrompt] = useState("");
197 const [imageUrl, setImageUrl] = useState("");
384}
385
386function client() {
387 createRoot(document.getElementById("root")).render(<App />);
388}
389if (typeof document !== "undefined") { client(); }
390
391export default async function server(req: Request): Promise<Response> {
392 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
393 const { falProxyRequest } = await import("https://esm.town/v/stevekrouse/falProxyRequest");

vigilantRedHamstermain.tsx1 match

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

fetchNewPublicGitHubReposmain.tsx1 match

@toowired•Updated 5 months ago
1export default async function fetchNewPublicGitHubRepos() {
2 // Generate today's date in YYYY-MM-DD format
3 const today = new Date().toISOString().split("T")[0];

honoOpenaimain.tsx2 matches

@wizos•Updated 5 months ago
348
349
350 // Helper function to get the supported MIME type
351 function getSupportedMimeType() {
352 const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
353 const mimeTypes = [

sendNotificationREADME.md1 match

@wizos•Updated 5 months ago
3This val can be used in other vals to send notifications to a segment using [OneSignal's REST API](https://documentation.onesignal.com/reference/create-notification)
4
5This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to [Netlify](https://www.netlify.com/) for free. OneSignal has [easy to follow docs](https://documentation.onesignal.com/docs/web-sdk-setup) so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then [install the PWA](https://www.bitcot.com/how-to-install-a-pwa-to-your-device/) on your platform of choice and you're off to the races!
6
7## Setup

extractValInfomain.tsx1 match

@wizos•Updated 5 months ago
1export function extractValInfo(url: string | URL) {
2 const { pathname, search } = new URL(url);
3 const [author, filename] = pathname.split("/").slice(-2);

perseveringAmaranthChipmunkmain.tsx1 match

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

uploadImagemain.tsx2 matches

@ajsol•Updated 5 months ago
4 * @returns {string} - uploaded image url
5 */
6export async function uploadImage(image: Blob): Promise<string> {
7 const fd = new FormData();
8 fd.append(
23 return data.result.variants[0];
24}
25async function getUploadURL(): Promise<string> {
26 const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27 "headers": {

resyBotREADME.md1 match

@cmdrtomalak•Updated 5 months ago
11import { email } from "https://esm.town/v/std/email?v=13";
12
13export default async function (interval: Interval) {
14 const bookingInfo = await resyBot( {
15 slug: 'amaro-bar',

affableMagentaPlanarianmain.tsx5 matches

@willthereader•Updated 5 months ago
359}
360
361// Main Function
362export async function findBrokenLinks(websiteUrl) {
363 try {
364 const links = await LinkFetcher.fetchLinksFromWebsite(websiteUrl);
384}
385
386function App() {
387 const [url, setUrl] = useState("");
388 const [results, setResults] = useState(null);
587}
588
589function client() {
590 createRoot(document.getElementById("root")).render(<App />);
591}
599let progressUpdateCount = 0;
600
601export default async function server(request: Request): Promise<Response> {
602 const url = new URL(request.url);
603

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