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=23&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 18796 results for "function"(1297ms)

luciaMagicLinkStarter

luciaMagicLinkStartersessions.ts4 matches

@stevekrouse•Updated 1 day ago
4import { SESSIONS_TABLE, USER_TABLE } from "./schema.ts";
5
6export function generateSessionToken(): string {
7 const bytes = new Uint8Array(20);
8 crypto.getRandomValues(bytes);
11}
12
13export async function createSession(token: string, userId: number): Promise<Session> {
14 const sessionId = encodeHexLowerCase(sha256(new TextEncoder().encode(token)));
15 const session: Session = {
25}
26
27export async function validateSessionToken(token: string): Promise<SessionValidationResult> {
28 const sessionId = encodeHexLowerCase(sha256(new TextEncoder().encode(token)));
29 const { rows } = await sqlite.execute(
87}
88
89export async function invalidateSession(sessionId: string): Promise<void> {
90 await sqlite.execute(`DELETE FROM ${SESSIONS_TABLE} WHERE id = ?`, [sessionId]);
91}

CareerCoach20DayleadManagement.ts6 matches

@prashamtrivedi•Updated 1 day ago
37 * @returns HTTP response with the dashboard HTML
38 */
39async function serveDashboard(req: Request) {
40 try {
41 // Get leads from database
76 * @returns Dashboard HTML
77 */
78function generateLeadDashboardHTML(leads: any[], pipeline: any[]) {
79 return `
80 <!DOCTYPE html>
733 });
734
735 function formatDate(dateString) {
736 if (!dateString) return 'Never';
737
756 * @returns HTML for pipeline stages
757 */
758function generatePipelineStages(pipeline: any[]) {
759 // Define the stages in order
760 const stageOrder = [
789 * @returns Formatted status string
790 */
791function formatStatus(status: string): string {
792 switch (status) {
793 case 'new': return 'New Lead';
808 * @returns Formatted date string
809 */
810function formatDate(dateString?: string): string {
811 if (!dateString) return 'Never';
812

CareerCoach20DaylogEntry.ts5 matches

@prashamtrivedi•Updated 1 day ago
51 * @returns Response with feedback
52 */
53async function handleDailyLog(content) {
54 try {
55 // Prepare log data
108 * @returns Response with status
109 */
110async function handleProgressMetrics(content) {
111 try {
112 // Prepare metrics data
147 * @returns Response with status
148 */
149async function handleTodoUpdate(content) {
150 try {
151 // Validate required fields
196}
197
198// Importing the updateTodo function here to avoid circular dependencies
199async function updateTodo(id: number, updates: any) {
200 // Build the SET part of the query dynamically based on provided updates
201 const updateFields = Object.entries(updates)

CareerCoach20Dayleads.ts4 matches

@prashamtrivedi•Updated 1 day ago
58 * @returns Response with leads
59 */
60async function handleGetLeads(status?: string) {
61 try {
62 const leads = await getLeads(status);
84 * @returns Response with pipeline stages and counts
85 */
86async function handleGetPipeline() {
87 try {
88 const pipeline = await getLeadsPipeline();
111 * @returns Response with created lead
112 */
113async function handleCreateLead(leadData: any) {
114 try {
115 // Validate required fields
164 * @returns Response with update status
165 */
166async function handleUpdateLead(leadData: any) {
167 try {
168 // Validate required fields

CareerCoach20Daytodos.ts3 matches

@prashamtrivedi•Updated 1 day ago
54 * @returns Response with todos
55 */
56async function handleGetTodos(status?: string) {
57 try {
58 const todos = await getTodos(status);
81 * @returns Response with created todo
82 */
83async function handleCreateTodo(todoData: any) {
84 try {
85 // Validate required fields
132 * @returns Response with update status
133 */
134async function handleUpdateTodo(todoData: any) {
135 try {
136 // Validate required fields

CareerCoach20Dayanalysis.ts9 matches

@prashamtrivedi•Updated 1 day ago
15 * @returns Analysis object with summary, focus areas, and recommendations
16 */
17export async function generateDailyAnalysis() {
18 try {
19 // Get data from database for context
78 * @returns Analysis object with summary, victories, challenges, and strategy
79 */
80export async function generateWeeklyAnalysis() {
81 try {
82 // Get data from database for context
156 * @returns Array of task objects
157 */
158export async function generateTodaysTasks(analysis: any) {
159 try {
160 // Get additional context from database
213 * @returns Analysis and next steps
214 */
215export async function processLogEntry(content: any) {
216 try {
217 // Select the appropriate model based on content complexity
240}
241
242// Helper functions to generate system prompts
243
244function getSystemPromptForDailyAnalysis() {
245 return `
246 You are an elite career coach for a senior developer seeking contracts quickly.
274}
275
276function getSystemPromptForWeeklyAnalysis() {
277 return `
278 You are an elite career strategist for a senior developer seeking contracts quickly.
311}
312
313function getSystemPromptForTaskGeneration() {
314 return `
315 You are an AI career strategist for a senior developer seeking contracts quickly.
345}
346
347function getSystemPromptForLogProcessing() {
348 return `
349 You are an AI career coach providing immediate feedback on daily progress.

CareerCoach20DayREADME.md1 match

@prashamtrivedi•Updated 1 day ago
30## Tech Stack
31
32- ValTown serverless functions
33- SQLite database for persistent storage
34- OpenAI API for AI-powered analysis and recommendations

sms-email-forwardmain.tsx1 match

@jflores•Updated 1 day ago
2import process from "node:process";
3
4export default async function handler(request: Request) {
5 if (request.method !== "POST") {
6 return Response.json({ message: "This val responds to POST requests." }, {
13}
14
15export function UserProfile({ user, onUpdate }: UserProfileProps) {
16 const [username, setUsername] = useState(user.username || "");
17 const [isEditing, setIsEditing] = useState(false);
luciaMagicLinkStarter

luciaMagicLinkStarterschema.ts1 match

@stevekrouse•Updated 1 day ago
5export const MAGIC_LINKS_TABLE = "lucia_demo_magic_links_v2";
6
7async function createTables() {
8 await sqlite.execute(`
9 CREATE TABLE IF NOT EXISTS ${USER_TABLE} (

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