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%22Image%20title%22?q=function&page=54&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 19282 results for "function"(981ms)

CareerCoach20Dayemail.ts8 matches

@prashamtrivedi•Updated 4 days ago
2
3/**
4 * Email utility functions for the Career Coach application
5 * Handles sending daily and weekly emails with analytics and tasks
6 */
11 * @returns Formatted date string
12 */
13export function formatDate(date: Date): string {
14 return date.toISOString().split('T')[0];
15}
20 * @returns Result of the email sending operation
21 */
22export async function sendDailyEmail(data: {
23 analysis: any;
24 tasks: any[];
51 * @returns Result of the email sending operation
52 */
53export async function sendWeeklyEmail(data: {
54 weeklyAnalysis: any;
55 strategy: any;
83 * @returns HTML content for the email
84 */
85async function generateDailyEmailContent(data: {
86 analysis: any;
87 tasks: any[];
139 * @returns HTML content for the email
140 */
141async function generateWeeklyEmailContent(data: {
142 weeklyAnalysis: any;
143 strategy: any;
238 * @returns Plain text version of the email
239 */
240function generatePlainTextVersion(htmlContent: string): string {
241 // This is a very basic HTML to plain text conversion
242 // In a production environment, you might want to use a dedicated library
277 * @returns Formatted priority string
278 */
279function renderPriority(priority: number): string {
280 switch (priority) {
281 case 1: return "🔥 CRITICAL";

CoffeTimecron.tsx1 match

@robertcardillo•Updated 4 days ago
15};
16
17export default async function(interval: Interval) {
18 const reminders = (await blob.getJSON(`coffeetime.reminders`) as Array<{
19 name: string;

EEPMOnitoringnewsArticle.tsx5 matches

@solomonferede•Updated 4 days ago
374
375// Main Component for the News Article Tab - Adapted to use inline styles and MediaMonitoringTab patterns
376export function NewsArticleTab({ user }) {
377 const [articles, setArticles] = useState([]);
378 const [title, setTitle] = useState("");
555 };
556
557 // Function to open the edit modal - Similar pattern to MediaMonitoringTab
558 const handleEditClick = (article) => {
559 // Assuming article properties match backend column names (e.g., main_idea, firstName, fatherName)
573 };
574
575 // Function to close the edit modal - Similar pattern to MediaMonitoringTab
576 const handleCloseEditModal = () => {
577 setIsEditModalOpen(false);
588 };
589
590 // Function to handle changes in the edit modal form - Similar pattern to MediaMonitoringTab
591 const handleEditFormChange = (e) => {
592 const { name, value } = e.target;
597 };
598
599 // Function to save the edited entry - Similar pattern to MediaMonitoringTab
600 const handleSaveEdit = async () => {
601 // Validate required fields from editFormData

CoffeTimeapi.tsx1 match

@robertcardillo•Updated 4 days ago
1import { blob } from "https://esm.town/v/std/blob";
2
3export default async function(req: Request): Promise<Response> {
4 const token = req.headers.get("authorization")?.split(" ")?.at(1);
5

EEPMOnitoringweeklyReport.tsx6 matches

@solomonferede•Updated 4 days ago
202};
203
204function WeeklyReportTab() {
205 // State for the detailed report (news and media)
206 const [detailedReport, setDetailedReport] = useState(null);
230 const [selectedAuthorName, setSelectedAuthorName] = useState("");
231
232 // Function to fetch the detailed report
233 const fetchDetailedReport = async () => {
234 // setWeeklySummary(null); // REMOVED: Don't clear summary when fetching detailed
244 };
245
246 // Function to fetch the weekly summary report
247 const fetchWeeklySummary = async () => {
248 // setDetailedReport(null); // REMOVED: Don't clear detailed when fetching summary
332 }, [weeklySummary]);
333
334 // Function to handle click on author name in Weekly Summary
335 const handleAuthorClick = (authorName) => {
336 // Now detailedReport is NOT cleared when switching to summary,
352 };
353
354 // Function to close the author detail modal
355 const handleCloseAuthorDetailModal = () => {
356 setIsAuthorDetailModalOpen(false);
359 };
360
361 // Helper function for CSV export (only for detailed report)
362 const exportToCSV = (data, filename) => {
363 if (!data || data.length === 0) {

EEPMOnitoringsetting.tsx1 match

@solomonferede•Updated 4 days ago
68 };
69
70 // Function to reset all form fields
71 const resetForm = () => {
72 setEmployeeId("");

TownieuseUsageStats.ts1 match

@pomdtr•Updated 4 days ago
1import { useEffect } from "https://esm.sh/react@18.2.0?dev";
2
3export function useUsageStats (messages: any[], usages: any[]) {
4 useEffect(() => {
5 if (!messages?.length) return;

TownieuseScrollToBottom.tsx3 matches

@pomdtr•Updated 4 days ago
7 *
8 * @param {Array} dependencies - Array of dependencies that trigger scrolling when changed
9 * @returns {Object} An object containing containerRef and scrollToBottom function
10 */
11export function useScrollToBottomContainer(dependencies = []) {
12 const containerRef = useRef(null);
13
28
29// body scroll version
30export function useScrollToBottom(dependencies = []) {
31 const bottomRef = useRef(null);
32

Townieuser-summary.ts1 match

@pomdtr•Updated 4 days ago
6 * This includes a fallback to inference calls data when usage data is missing
7 */
8export async function getUserSummary() {
9 // First, get the standard grouped data from the usage table
10 const groupedUsageData = await sqlite.execute(`

TownieuseProject.tsx1 match

@pomdtr•Updated 4 days ago
5const FILES_ENDPOINT = "/api/project-files";
6
7export function useProject (projectId: string, branchId?: string) {
8 const { token } = useAuth();
9 const [data, setData] = useState<any>(null);

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 3 weeks 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.