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/$%7Bart_info.art.src%7D?q=database&page=247&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 4142 results for "database"(1387ms)

stevensDemogenerateFunFacts.ts2 matches

@vasusenโ€ขUpdated 4 weeks ago
8
9/**
10 * Retrieves previously generated fun facts from the memories database
11 * @returns Array of previous fun facts
12 */
47
48/**
49 * Inserts a fun fact into the memories database
50 * @param date Date for the fun fact in ISO format
51 * @param factText The fun fact text

stevensDemo.cursorrules2 matches

@vasusenโ€ขUpdated 4 weeks ago
208```
209โ”œโ”€โ”€ backend/
210โ”‚ โ”œโ”€โ”€ database/
211โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
212โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
270- Handle API calls properly with proper error catching
271
272### Database Patterns
273- Run migrations on startup or comment out for performance
274- Change table names when modifying schemas rather than altering

petitPrinceworkspace.xml1 match

@smirfolioโ€ขUpdated 4 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" />

petitPrinceindex.js10 matches

@smirfolioโ€ขUpdated 4 weeks ago
184 const blogId = url.pathname.split("/")[2];
185
186 // Import the database queries
187 const { getGeneratedBlog } = await import("./backend/database/queries.js");
188
189 // Get the blog from the database
190 const blog = await getGeneratedBlog(blogId);
191
214 // }
215 //
216 // // If a title was found, update the blog in the database
217 // if (extractedTitle) {
218 // console.log(`Extracted title: "${extractedTitle}" for blog ID: ${blogId}`);
219 //
220 // // Import the updateGeneratedBlog function
221 // const { updateGeneratedBlog } = await import("./backend/database/queries.js");
222 //
223 // // Update the blog_title in the database
224 // await updateGeneratedBlog(blogId, { blog_title: extractedTitle });
225 //
269 const { generateHtmlBlog } = await import("./backend/htmlGenerator.js");
270
271 // Generate the HTML blog and save it to the database
272 const blogData = await generateHtmlBlog(summary, originalUrl, ageRange, images);
273
285 else if (url.pathname === "/api/blogs" && req.method === "GET") {
286 try {
287 // Import the database queries
288 const { getAllGeneratedBlogs } = await import("./backend/database/queries.js");
289
290 // Get all blogs from the database
291 const blogs = await getAllGeneratedBlogs();
292

petitPrincedocumentation.html1 match

@smirfolioโ€ขUpdated 4 weeks ago
160 <div>
161 <h3 class="text-xl font-medium text-blue-300">4. Storage</h3>
162 <p class="mt-1">The generated blog is saved in a database so you can access it later using the same link.</p>
163 </div>
164 </div>

petitPrincehtmlGenerator.js7 matches

@smirfolioโ€ขUpdated 4 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

petitPrincequeries.js4 matches

@smirfolioโ€ขUpdated 4 weeks ago
4export async function saveGeneratedBlog(summary, originalUrl, ageRange, htmlContent, images = '[]') {
5 try {
6 console.log(`Saving blog to database: ${originalUrl} for age range ${ageRange}`);
7
8 const result = await sqlite.execute(
24 console.error("Failed to verify blog was saved!");
25 } else {
26 console.log("Blog save verified in database");
27 }
28
29 return blogId;
30 } catch (error) {
31 console.error("Error saving blog to database:", error);
32 throw new Error(`Failed to save blog: ${error.message}`);
33 }
60
61/**
62 * Updates an existing blog in the database
63 * @param {number} blogId - The ID of the blog to update
64 * @param {Object} updateData - The data to update (any of: summary, original_url, age_range, html_content, images)

cdgwsdsetupTelegramChatDb.ts2 matches

@cdgwsdโ€ขUpdated 4 weeks ago
1// Script to set up the telegram_chats table in SQLite
2// Run this script manually to create the database table
3
4export default async function setupTelegramChatDb() {
25 `);
26
27 return "Telegram chat database table created successfully.";
28 } catch (error) {
29 console.error("Error setting up telegram_chats table:", error);

cdgwsdREADME.md3 matches

@cdgwsdโ€ขUpdated 4 weeks ago
13## Technical Architecture
14
15**โš ๏ธ important caveat: the admin dashboard doesn't have auth! currently it just relies on security by obscurity of people not knowing the url to a private val. this is not very secure. if you fork this project and put sensitive data in a database you should think carefully about how to secure it.**
16
17Stevens has been designed with the utmost simplicity and extensibility, much like a well-organized household. At the heart of his operation lies a single "memories" table - a digital equivalent of a butler's meticulous records. This table serves as the foundation for all of Stevens' operations.
45- `dashboard`: the admin view for showing the memories notebook + visualizing imports
46- `dailyBriefing`: stuff related to sending a daily update via telegram
47- `dbUtils`: little one-off scripts for database stuff
48
49## Hiring your own Stevens
57- For the Google Calendar integration you'll need `GOOGLE_CALENDAR_ACCOUNT_ID` and `GOOGLE_CALENDAR_CALENDAR_ID`. See [these instuctions](https://www.val.town/v/stevekrouse/pipedream) for details.
58
59**important caveat: the admin dashboard doesn't have auth! currently it just relies on security by obscurity of people not knowing the url to a private val. this is not very secure, if you put sensitive data in a database you should think carefully about how to secure it.**
60
61Overall it's a simple enough project that I encourage you to just copy the ideas and run in your own direction rather than try to use it as-is.

cdgwsdREADME.md2 matches

@cdgwsdโ€ขUpdated 4 weeks ago
4
5* `index.ts` - this is the **entrypoint** for this whole project
6* `database/` - this contains the code for interfacing with the app's SQLite database table
7
8## Hono
26## CRUD API Routes
27
28This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
29
30## Errors

bookmarksDatabase

@s3thiโ€ขUpdated 2 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 5 months ago