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=database&page=208&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=database

Returns an array of strings in format "username" or "username/projectName"

Found 7167 results for "database"(713ms)

petitPrincehtmlGenerator.js7 matches

@smirfolioโ€ขUpdated 2 weeks ago
1import { InferenceClient } from "npm:@huggingface/inference";
2import { createBlogTable } from "./database/migrations.js";
3import { saveGeneratedBlog } from "./database/queries.js";
4import { updateGeneratedBlog } from "./database/queries.js";
5// Initialize the Hugging Face inference client
6const client = new InferenceClient(Deno.env.get("HUGGINGFACE_API_KEY"));
10
11/**
12 * Generates an HTML blog page from the summarized content and saves it to the database
13 * @param {string} summary - The summarized content
14 * @param {string} originalUrl - The original article URL
24) {
25 try {
26 // Save the generated blog to the database with images JSON
27 const blogId = await saveGeneratedBlog(
28 summary,
61 }
62
63 // Save the generated blog to the database with images JSON
64 await updateGeneratedBlog(blogId, {
65 summary,
70 });
71
72 // Log successful save to database
73 console.log(`Successfully saved blog with ID: ${blogId}`);
74

untitled-69initializeTable.ts5 matches

@tonyhschuโ€ขUpdated 2 weeks ago
1import { sqlite } from "https://esm.town/v/std/sqlite";
2
3export default async function initializeDatabase()
4{
5 try {
15 `);
16
17 console.log("Database initialized successfully!");
18 return "Database schema created";
19 } catch (error) {
20 console.error("Error initializing database:", error);
21 return `Error: ${error.message}`;
22 }
23}
24
25await initializeDatabase();

sqliteExplorerAppREADME.md1 match

@tonyhschuโ€ขUpdated 2 weeks ago
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable

petitPrinceindex.js10 matches

@smirfolioโ€ขUpdated 2 weeks ago
172 const blogId = url.pathname.split("/")[2];
173
174 // Import the database queries
175 const { getGeneratedBlog } = await import("./backend/database/queries.js");
176
177 // Get the blog from the database
178 const blog = await getGeneratedBlog(blogId);
179
202 // }
203 //
204 // // If a title was found, update the blog in the database
205 // if (extractedTitle) {
206 // console.log(`Extracted title: "${extractedTitle}" for blog ID: ${blogId}`);
207 //
208 // // Import the updateGeneratedBlog function
209 // const { updateGeneratedBlog } = await import("./backend/database/queries.js");
210 //
211 // // Update the blog_title in the database
212 // await updateGeneratedBlog(blogId, { blog_title: extractedTitle });
213 //
257 const { generateHtmlBlog } = await import("./backend/htmlGenerator.js");
258
259 // Generate the HTML blog and save it to the database
260 const blogData = await generateHtmlBlog(summary, originalUrl, ageRange, images);
261
273 else if (url.pathname === "/api/blogs" && req.method === "GET") {
274 try {
275 // Import the database queries
276 const { getAllGeneratedBlogs } = await import("./backend/database/queries.js");
277
278 // Get all blogs from the database
279 const blogs = await getAllGeneratedBlogs();
280

petitPrinceworkspace.xml1 match

@smirfolioโ€ขUpdated 2 weeks ago
6 <component name="ChangeListManager">
7 <list default="true" id="590811ff-77d1-4512-b4ce-38214d91160b" name="Changes" comment="">
8 <change beforePath="$PROJECT_DIR$/backend/database/queries.js" beforeDir="false" afterPath="$PROJECT_DIR$/backend/database/queries.js" afterDir="false" />
9 <change beforePath="$PROJECT_DIR$/backend/htmlGenerator.js" beforeDir="false" afterPath="$PROJECT_DIR$/backend/htmlGenerator.js" afterDir="false" />
10 <change beforePath="$PROJECT_DIR$/backend/huggingface.js" beforeDir="false" afterPath="$PROJECT_DIR$/backend/huggingface.js" afterDir="false" />

projectindex.ts2 matches

@greeshmaโ€ขUpdated 2 weeks ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import sessions from "./routes/sessions.ts";
5import stats from "./routes/stats.ts";
12});
13
14// Initialize database on startup
15await runMigrations();
16

projectstats.ts1 match

@greeshmaโ€ขUpdated 2 weeks ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getDailyStats, getWeeklyStats, getTotalStats } from "../database/queries.ts";
3import type { StatsResponse } from "../../shared/types.ts";
4

projectsessions.ts1 match

@greeshmaโ€ขUpdated 2 weeks ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { createSession, updateSession, getRecentSessions } from "../database/queries.ts";
3import type { PomodoroSession } from "../../shared/types.ts";
4

projectREADME.md4 matches

@greeshmaโ€ขUpdated 2 weeks ago
28```
29โ”œโ”€โ”€ backend/
30โ”‚ โ”œโ”€โ”€ database/
31โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Database schema
32โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # Database operations
33โ”‚ โ”œโ”€โ”€ routes/
34โ”‚ โ”‚ โ”œโ”€โ”€ sessions.ts # Session CRUD operations
60- **Frontend**: React 18.2.0 with TypeScript
61- **Backend**: Hono framework
62- **Database**: SQLite
63- **Styling**: TailwindCSS
64- **Charts**: Chart.js

screenscoring.ts2 matches

@max123โ€ขUpdated 2 weeks ago
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import type { AddPointRequest, ApiResponse, PointLog, ScoreUpdate } from "../../shared/types.ts";
4import * as db from "../database/queries.ts";
5
6const scoring = new Hono();
140 pointHistory[pointHistory.length - 2].serverNumber : 1;
141
142 // Remove the last point from database
143 await sqlite.execute("DELETE FROM point_logs WHERE id = ?", [lastPoint.id]);
144

bookmarksDatabase

@s3thiโ€ขUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 6 months ago