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/$%7Bsuccess?q=database&page=196&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 7087 results for "database"(820ms)

Towniequeries.tsx1 match

@downchuck_gmail_comโ€ขUpdated 1 week ago
4import { INFERENCE_CALLS_TABLE, USAGE_TABLE } from "./schema.tsx";
5
6// Eventually we'll have a user database,
7// but in the meantime, we can cache user info in memory
8const userIdCache: { [key: string]: any } = {};

Townie.cursorrules2 matches

@downchuck_gmail_comโ€ขUpdated 1 week ago
198```
199โ”œโ”€โ”€ backend/
200โ”‚ โ”œโ”€โ”€ database/
201โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
202โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
257 ```
258
259### Database Patterns
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering

cerebras_codermain.tsx2 matches

@downchuck_gmail_comโ€ขUpdated 1 week ago
1import { serveFile } from "https://esm.town/v/std/utils/index.ts";
2import { generateCode } from "./backend/generate-code.ts";
3import { createTables } from "./database/migrations.ts";
4import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries.ts";
5
6await createTables();

cerebras_codermain.tsx2 matches

@Downchuckโ€ขUpdated 1 week ago
1import { serveFile } from "https://esm.town/v/std/utils/index.ts";
2import { generateCode } from "./backend/generate-code.ts";
3import { createTables } from "./database/migrations.ts";
4import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries.ts";
5
6await createTables();

con-juanindex.html19 matches

@Downchuckโ€ขUpdated 1 week ago
124 </label>
125 <label class="flex items-center text-sm">
126 <input type="radio" name="privacy-mode" value="database" class="mr-2">
127 <span>โ˜๏ธ Save to server (shareable, persistent)</span>
128 </label>
300 </label>
301 <label class="flex items-start text-sm">
302 <input type="radio" name="modal-privacy-mode" value="database" class="mr-2 mt-0.5">
303 <div>
304 <span class="font-medium">โ˜๏ธ Save to server</span>
552 statusText = 'Local mode - data saved in browser only';
553 break;
554 case 'database':
555 statusText = 'Server mode - data saved on server';
556 break;
567 statusText = `${localCount} session(s) in browser`;
568 clearLocalDataBtn.style.display = localCount > 0 ? 'block' : 'none';
569 } else if (state.privacyMode === 'database') {
570 statusText = `${serverCount} session(s) on server`;
571 clearServerDataBtn.style.display = serverCount > 0 ? 'block' : 'none';
580 clearLocalDataBtn.style.display = 'none';
581 }
582 if (state.privacyMode !== 'database') {
583 clearServerDataBtn.style.display = 'none';
584 }
652 async function loadSessions() {
653 try {
654 if (state.privacyMode === 'database') {
655 // Load from server database
656 const response = await fetch('/chat-api', {
657 method: 'POST',
719 if (state.privacyMode === 'local') {
720 privacyIndicator = '<span class="text-xs text-blue-500">๐Ÿ’พ</span>';
721 } else if (state.privacyMode === 'database') {
722 privacyIndicator = '<span class="text-xs text-green-500">โ˜๏ธ</span>';
723 }
756 if (confirm('Are you sure you want to delete this session?')) {
757 try {
758 if (state.privacyMode === 'database') {
759 await fetch('/chat-api', {
760 method: 'POST',
792 let sessionData = null;
793
794 if (state.privacyMode === 'database') {
795 // Load from server
796 const response = await fetch('/chat-api', {
840 indicator = '<span class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded">๐Ÿ’พ Local</span>';
841 break;
842 case 'database':
843 indicator = '<span class="text-xs bg-green-100 text-green-800 px-2 py-1 rounded">โ˜๏ธ Server</span>';
844 break;
883
884 try {
885 if (state.privacyMode === 'database') {
886 await fetch('/chat-api', {
887 method: 'POST',
1011 let newSession = null;
1012
1013 if (selectedMode === 'database') {
1014 // Create on server
1015 const response = await fetch('/chat-api', {
1080 indicator = '<span class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded">๐Ÿ’พ Local</span>';
1081 break;
1082 case 'database':
1083 indicator = '<span class="text-xs bg-green-100 text-green-800 px-2 py-1 rounded">โ˜๏ธ Server</span>';
1084 break;
1101 privacyMessage = '๐Ÿ’พ This session is saved locally in your browser only.';
1102 break;
1103 case 'database':
1104 privacyMessage = 'โ˜๏ธ This session is saved on the server and can be accessed from any device.';
1105 break;
1146
1147 try {
1148 if (state.privacyMode === 'database') {
1149 await fetch('/chat-api', {
1150 method: 'POST',
1209 if (!text) return;
1210
1211 // Check if we need to create a session first (only for database mode)
1212 if (!state.currentSession && state.privacyMode === 'database') {
1213 showNewSessionModal();
1214 return;
1275 let messageResponse = null;
1276
1277 if (state.privacyMode === 'database') {
1278 // Send to server for processing
1279 const response = await fetch('/chat-api', {

petitPrincedocumentation.html1 match

@smirfolioโ€ขUpdated 1 week ago
136 <div>
137 <h3 class="text-xl font-medium text-blue-300">4. Storage</h3>
138 <p class="mt-1">The generated blog is saved in a database so you can access it later using the same link.</p>
139 </div>
140 </div>

imagiindex.ts1 match

@kartik308โ€ขUpdated 1 week ago
11});
12
13// Sample data - in a real app, this would come from a database
14const sampleGalleryItems: GalleryItem[] = [
15 {

sqliteExplorerAppREADME.md1 match

@stu43005โ€ขUpdated 1 week 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

vibeCoding_PLPapi.py2 matches

@Danchiโ€ขUpdated 1 week ago
5from datetime import datetime, timedelta
6
7from database.connection import get_db_connection, prepare_json_field, parse_json_field
8from database.models import (
9 Store, StoreCreate, Product, ProductCreate, Transaction, TransactionCreate,
10 Category, CategoryCreate, FinancialHealth, DashboardData, ApiResponse,

vibeCoding_PLPconnection.py13 matches

@Danchiโ€ขUpdated 1 week ago
6from datetime import datetime
7
8# Database configuration
9DB_CONFIG = {
10 'host': os.getenv('MYSQL_HOST', 'localhost'),
12 'user': os.getenv('MYSQL_USER', 'root'),
13 'password': os.getenv('MYSQL_PASSWORD', ''),
14 'database': os.getenv('MYSQL_DATABASE', 'storefront_builder'),
15 'charset': 'utf8mb4',
16 'collation': 'utf8mb4_unicode_ci'
17}
18
19class DatabaseConnection:
20 def __init__(self):
21 self.connection = None
71 return False
72
73# Global database connection instance
74db = DatabaseConnection()
75
76async def get_db_connection():
79 return db
80
81async def init_database():
82 """Initialize database and create tables if they don't exist"""
83 try:
84 # First, create database if it doesn't exist
85 temp_config = DB_CONFIG.copy()
86 temp_config.pop('database', None)
87
88 temp_connection = mysql.connector.connect(**temp_config)
89 temp_cursor = temp_connection.cursor()
90
91 temp_cursor.execute(f"CREATE DATABASE IF NOT EXISTS {DB_CONFIG['database']} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci")
92 temp_cursor.close()
93 temp_connection.close()
94
95 # Now connect to the database and create tables
96 await db.connect()
97
99 await create_tables()
100
101 print("Database initialized successfully!")
102
103 except Error as e:
104 print(f"Error initializing database: {e}")
105 raise e
106

bookmarksDatabase

@s3thiโ€ขUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 6 months ago