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/$1?q=function&page=2411&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 27812 results for "function"(6465ms)

turnitdownmain.tsx1 match

@yawnxyz•Updated 9 months ago
82});
83
84export default async function server(req: Request): Promise<Response> {
85 return app.fetch(req);
86}

turnitdownREADME.md1 match

@yawnxyz•Updated 9 months ago
141. The application uses the Hono framework to create a simple web server.
152. HTMX is used for handling AJAX requests without writing JavaScript.
163. Alpine.js provides reactivity for the clipboard functionality.
174. The Turndown library is used to convert HTML to Markdown.
18

newslymain.tsx2 matches

@yawnxyz•Updated 9 months ago
1/**
2 * This val creates an email storage system using SQLite.
3 * It stores each email sent through the 'newsly' function into a SQLite database.
4 * The email address of the sender is used as the key.
5 * We'll use the sqlite module for database operations and the email module for sending emails.
9
10
11export async function newsly2(e: {
12 from: string;
13 to: string[];

excessPlumCapybaramain.tsx2 matches

@yawnxyz•Updated 9 months ago
8};
9
10export async function sendSMS(phoneNumber: string, message: string, carrier: string): Promise<void> {
11 const carrierDomain = carriers[carrier.toLowerCase()];
12 if (!carrierDomain) {
22 text: message,
23 });
24 console.log('Email function returned:', result);
25 console.log('SMS sent successfully');
26 } catch (error) {

telegramWebhookEchoMessagemain.tsx1 match

@yawnxyz•Updated 9 months ago
24});
25
26async function sendMessage(chatId, text) {
27 try {
28 const url = `${TELEGRAM_API_URL}/sendMessage`;

iconExplorermain.tsx3 matches

@all•Updated 9 months ago
12const ITEMS_PER_PAGE = 30;
13
14function App() {
15 const [searchTerm, setSearchTerm] = useState("");
16 const [packages, setPackages] = useState([]);
89}
90
91function client() {
92 createRoot(document.getElementById("root")).render(<App />);
93}
95if (typeof document !== "undefined") { client(); }
96
97async function server(request: Request): Promise<Response> {
98 const url = new URL(request.url);
99

whatsappWebhookExamplemain.tsx1 match

@yawnxyz•Updated 9 months ago
15 */
16
17export default async function(req: Request): Promise<Response> {
18 // HANDLE GET REQUEST FOR 'VERIFICATION REQUESTS'
19 if (req.method === "GET") {

todaystatsmain.tsx12 matches

@ejfox•Updated 9 months ago
11
12// Ensure the table exists
13async function ensureTableExists() {
14 await sqlite.execute(`
15 CREATE TABLE IF NOT EXISTS ${KEY}_world_state (
21}
22
23// Utility function for fetching JSON data
24async function fetchJSON(url: string) {
25 try {
26 const response = await fetch(url);
36
37// Convert Celsius to Fahrenheit
38function celsiusToFahrenheit(celsius: number): number {
39 return (celsius * 9) / 5 + 32;
40}
41
42// Utility function for fetching Wolfram Alpha data
43async function fetchWolframData(query: string) {
44 const appId = 'K8UTGR-8Y5G3A3VTP';
45 const url = `http://api.wolframalpha.com/v1/result?appid=${appId}&i=${encodeURIComponent(query)}`;
56}
57
58// Utility function for fetching Alpha Vantage stock data
59async function fetchStockData(symbol: string) {
60 const apiKey = 'TD7I78XY3N2AGKWP';
61 const url = `https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=${symbol}&interval=5min&apikey=${apiKey}`;
62 try {
63 const data = await fetchJSON(url);
75}
76
77async function getWorldState(): Promise<object> {
78 // Ensure the table exists
79 await ensureTableExists();
267 </div>
268 <script>
269 async function fetchData() {
270 try {
271 const response = await fetch(window.location.href);
283`;
284
285export default async function server(request: Request): Promise<Response> {
286 if (request.method === 'GET' && request.headers.get('accept')?.includes('text/html')) {
287 return new Response(html, {

nasamain.tsx2 matches

@ejfox•Updated 9 months ago
10const NASA_API_KEY = 'vYg1cCNLVbcgNemMWuLEjoJsGOGbBXZjZjmwVwuV';
11
12async function fetchNASAData() {
13 const today = new Date().toISOString().split('T')[0];
14
103}
104
105export default async function server(request: Request): Promise<Response> {
106 try {
107 const nasaData = await fetchNASAData();

eclipsetodaymain.tsx1 match

@ejfox•Updated 9 months ago
5 */
6
7export default async function server(request: Request): Promise<Response> {
8 try {
9 // Hardcoded list of eclipses for 2024-2026

getFileEmail4 file matches

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

tuna8 file matches

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