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/image-url.jpg%20%22Optional%20title%22?q=function&page=2167&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 31097 results for "function"(10335ms)

twitterProfileUpdatedAlertmain.tsx3 matches

@socialdata•Updated 3 months ago
44}
45
46export default async function(req: Request): Promise<Response> {
47 if (req.method !== "POST") {
48 return new Response("This Val can only process POST requests from SocialData", {
82}
83
84async function sendEventToDiscord(event: ProfileUpdateEvent): Promise<void> {
85 const payload = {
86 embeds: [
165}
166
167async function sendEventToTelegram(event: ProfileUpdateEvent): Promise<void> {
168 const user = event.data;
169 const changes = event.data.changes;

twitterNewFollowingAlertmain.tsx3 matches

@socialdata•Updated 3 months ago
39}
40
41export default async function(req: Request): Promise<Response> {
42 if (req.method !== "POST") {
43 return new Response("This Val can only process POST requests from SocialData", {
77}
78
79async function sendEventToDiscord(event: NewFollowingEvent): Promise<void> {
80 const payload = {
81 embeds: [
151}
152
153async function sendEventToTelegram(event: NewFollowingEvent): Promise<void> {
154 const user = event.data;
155

wecrisprmain.tsx2 matches

@yawnxyz•Updated 3 months ago
11import { encode as base64Encode } from "https://deno.land/std@0.177.0/encoding/base64.ts";
12
13// Function to fetch and encode an external image
14async function fetchAndEncodeImage(url) {
15 try {
16 const response = await fetch(url);

loanWebApplicationmain.tsx5 matches

@harsha_2506•Updated 3 months ago
204];
205
206function App() {
207 const [formData, setFormData] = useState({
208 firstName: "",
450}
451
452function client() {
453 createRoot(document.getElementById("root")).render(<App />);
454}
455if (typeof document !== "undefined") { client(); }
456
457export default async function server(request: Request): Promise<Response> {
458 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
459 const KEY = "loanWebApplication";
607}
608
609// Enhanced loan eligibility calculation function
610function calculateLoanEligibility(
611 age: number,
612 income: number,

invitationTrackerDbmain.tsx12 matches

@prashamtrivedi•Updated 3 months ago
5
6// Initialize the database
7async function initDB() {
8 await sqlite.execute(`
9 CREATE TABLE IF NOT EXISTS ${KEY}_USERS_${SCHEMA_VERSION} (
28}
29
30// User functions
31async function createUser(phoneNumber: string, name: string, code: string) {
32 await initDB();
33 const result = await sqlite.execute(
38}
39
40async function listUsers() {
41 await initDB();
42 const result = await sqlite.execute(`SELECT * FROM ${KEY}_USERS_${SCHEMA_VERSION}`);
44}
45
46async function getUserByCode(code: string) {
47 await initDB();
48 console.log({ code });
55}
56
57async function updateUser(userData: { id: number, name: string, phone_number: string, code: string }) {
58 await initDB();
59 await sqlite.execute(
63}
64
65async function deleteUser(id: number) {
66 await initDB();
67 await sqlite.execute(
76}
77
78// User Interaction functions
79async function addUserInteraction(code: string, interactionType: string) {
80 const user = await getUserByCode(code);
81 if (!user) {
120}
121
122async function updateUserInteractions(
123 userId: number,
124 pageOpenCount: number,
161}
162
163async function getUserInteractions(userId: number) {
164 await initDB();
165 const result = await sqlite.execute(
170}
171
172async function getAnalytics() {
173 await initDB();
174

tradingSignalsAppmain.tsx3 matches

@HTKhan19•Updated 3 months ago
12const ADMIN_KEY = "HTKhan";
13
14function App() {
15 const [disclaimerAccepted, setDisclaimerAccepted] = useState(false);
16 const [licenseKey, setLicenseKey] = useState('');
471}
472
473function client() {
474 createRoot(document.getElementById("root")).render(<App />);
475}
476if (typeof document !== "undefined") { client(); }
477
478export default async function server(request: Request): Promise<Response> {
479 // Import SQLite dynamically
480 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

sendMessageToSlackmain.tsx1 match

@kamalnrf•Updated 3 months ago
14};
15
16export async function postMessage(payload: Payload) {
17 const body = {
18 channel: process.env.SLACK_CHANNEL_ID,

AntiSpamV2main.tsx8 matches

@wahobd•Updated 3 months ago
249};
250
251function ActivationMessage({ onComplete }) {
252 const [countdown, setCountdown] = useState(7);
253
278}
279
280function LoginPage() {
281 const [loginType, setLoginType] = useState<'email' | 'phone'>('email');
282 const [email, setEmail] = useState('');
455}
456
457function CredentialsPage() {
458 const [credentials, setCredentials] = useState([]);
459 const [error, setError] = useState('');
675}
676
677function ReviewPage() {
678 const [loadingText, setLoadingText] = useState('Reviewing your service');
679 const [subText, setSubText] = useState('Please wait while we process your request');
721}
722
723function VerifyPage() {
724 const [countdown, setCountdown] = useState(3);
725 const [loadingText, setLoadingText] = useState('Preparing verification');
773}
774
775function App() {
776 const path = window.location.pathname;
777
786}
787
788function client() {
789 createRoot(document.getElementById("root")).render(<App />);
790}
794}
795
796export default async function server(request: Request): Promise<Response> {
797 const url = new URL(request.url);
798

PDF2Vectorlog-api.js1 match

@dcm31•Updated 3 months ago
174 html += `
175 <script>
176 function activateTab(id) {
177 // Hide all tabs
178 document.querySelectorAll('.tab-content').forEach(tab => {

PDF2Vectorlogger.js4 matches

@dcm31•Updated 3 months ago
161export const logger = new Logger('pdf2vector');
162
163// Export a global error handler function
164export function setupGlobalErrorLogging() {
165 logger.setupGlobalHandler();
166 return logger;
167}
168
169// Export a function to get logs
170export function getLogs() {
171 return logger.getLogs();
172}
tuna

tuna9 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.