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?q=function&page=1&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 24819 results for "function"(1805ms)

VA-TASK-TIDYemailService.ts3 matches

@aishatopeyemi•Updated 46 mins ago
4const BASE_URL = "https://va-task-tidy.web.val.run"; // Update this to your actual domain
5
6export async function sendEveningCheckIn(user: User, taskSet: TaskSet, responseToken: string) {
7 const yesUrl = `${BASE_URL}/api/complete?token=${responseToken}&completed=true`;
8 const noUrl = `${BASE_URL}/api/complete?token=${responseToken}&completed=false`;
182}
183
184export async function sendMorningReminder(user: User, taskSet: TaskSet) {
185 const html = `
186 <!DOCTYPE html>
341}
342
343export async function sendCompletionConfirmation(user: User, completed: boolean) {
344 if (completed) {
345 const html = `

VA-TASK-TIDYqueries.ts11 matches

@aishatopeyemi•Updated 46 mins ago
4
5// User operations
6export async function createOrUpdateUser(name: string, email: string): Promise<User> {
7 // Try to find existing user
8 const existingUser = await sqlite.execute(
33}
34
35export async function getUserByEmail(email: string): Promise<User | null> {
36 const result = await sqlite.execute(
37 `SELECT * FROM ${TABLE_NAMES.USERS} WHERE email = ?`,
42
43// Task set operations
44export async function createTaskSet(
45 userId: number,
46 task1: string,
68}
69
70export async function getTaskSetByUserAndDate(userId: number, date: string): Promise<TaskSet | null> {
71 const result = await sqlite.execute(
72 `SELECT * FROM ${TABLE_NAMES.TASK_SETS} WHERE user_id = ? AND date = ?`,
76}
77
78export async function getTaskSetById(id: number): Promise<TaskSet | null> {
79 const result = await sqlite.execute(
80 `SELECT * FROM ${TABLE_NAMES.TASK_SETS} WHERE id = ?`,
85
86// Task completion operations
87export async function createTaskCompletion(
88 userId: number,
89 taskSetId: number,
111}
112
113export async function getCompletionByToken(token: string): Promise<TaskCompletion | null> {
114 const result = await sqlite.execute(
115 `SELECT * FROM ${TABLE_NAMES.COMPLETIONS} WHERE response_token = ?`,
119}
120
121export async function getCompletionByUserAndDate(userId: number, date: string): Promise<TaskCompletion | null> {
122 const result = await sqlite.execute(
123 `SELECT * FROM ${TABLE_NAMES.COMPLETIONS} WHERE user_id = ? AND completion_date = ?`,
128
129// Dashboard data
130export async function getDashboardData(userId: number): Promise<DashboardData> {
131 const user = await sqlite.execute(
132 `SELECT * FROM ${TABLE_NAMES.USERS} WHERE id = ?`,
182
183// Get users who need evening reminders (have tasks for today but no completion record)
184export async function getUsersNeedingEveningReminder(): Promise<Array<{user: User, taskSet: TaskSet}>> {
185 const today = new Date().toISOString().split('T')[0];
186
213
214// Get users who need morning reminders (marked incomplete yesterday)
215export async function getUsersNeedingMorningReminder(): Promise<Array<{user: User, taskSet: TaskSet, completion: TaskCompletion}>> {
216 const yesterday = new Date();
217 yesterday.setDate(yesterday.getDate() - 1);

VA-TASK-TIDYmigrations.ts1 match

@aishatopeyemi•Updated 47 mins ago
8const COMPLETIONS_TABLE = 'va_task_tidy_completions_v1';
9
10export async function runMigrations() {
11 console.log('Running database migrations...');
12

markdownBlogStarterLayout.tsx1 match

@Medix•Updated 58 mins ago
2import type { ReactNode } from "npm:react@18.2.0";
3
4export function Layout({ children }: { children: ReactNode }) {
5 return (
6 <html lang="en">

markdownBlogStarterindex.tsx3 matches

@Medix•Updated 58 mins ago
5import { Layout } from "./Layout.tsx";
6
7function PostComponent({ markdown, link }: { markdown: string; link?: string }) {
8 return (
9 <div style={{ border: "1px solid gray", padding: "10px", marginBottom: "20px", borderRadius: "5px" }}>
14}
15
16export default async function(req: Request): Promise<Response> {
17 const url = new URL(req.url);
18 if (url.pathname === "/") {
44}
45
46function html(children: React.ReactNode) {
47 return new Response(
48 renderToString(

VA_TASK_TIDYmigrations.ts1 match

@aishat•Updated 1 hour ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3export async function runMigrations() {
4 try {
5 // Users table

VA_TASK_TIDYemail.ts2 matches

@aishat•Updated 1 hour ago
4const BASE_URL = "https://vatasktidy-backend.web.val.run"; // Update this with your actual val URL
5
6export async function sendEveningReminder(user: User, tasks: DailyTasks) {
7 const today = new Date().toISOString().split('T')[0];
8 const yesUrl = `${BASE_URL}/api/complete/${user.id}/${today}/true`;
66}
67
68export async function sendMorningReminder(user: User, tasks: DailyTasks) {
69 const yesterday = new Date();
70 yesterday.setDate(yesterday.getDate() - 1);

VA_TASK_TIDYmorning-reminder.ts1 match

@aishat•Updated 1 hour ago
10import { sendMorningReminder } from "../backend/routes/email.ts";
11
12export default async function morningReminderCron() {
13 console.log("Running morning reminder cron job...");
14

VA_TASK_TIDYevening-reminder.ts1 match

@aishat•Updated 1 hour ago
9import { sendEveningReminder } from "../backend/routes/email.ts";
10
11export default async function eveningReminderCron() {
12 console.log("Running evening reminder cron job...");
13

VA_TASK_TIDYDashboard.tsx1 match

@aishat•Updated 1 hour ago
8}
9
10export default function Dashboard({ data, onNewTasks }: DashboardProps) {
11 if (!data) {
12 return (

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.