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/?q=database&page=275&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 2775 results for "database"(680ms)

cerebras_coderindex2 matches

@rollout•Updated 2 months ago
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {

cerebras_coderindex2 matches

@SKULLFUNKIE13•Updated 2 months ago
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {

cerebras_coderindex2 matches

@McZie•Updated 2 months ago
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {

cerebras_coderindex2 matches

@stevekrouse•Updated 2 months ago
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {

InstantQueryApp1 match

@vawogbemi•Updated 2 months ago
25 const query = JSON.parse(results!);
26
27 // In a real application, you would use the query to fetch data from the database
28 // For this example, we'll just return the query itself
29 return new Response(JSON.stringify({ query, results: "Sample results would go here" }), {

InstantQuerygetSystemPrompt4 matches

@vawogbemi•Updated 2 months ago
1function getSystemPrompt(schema: string) {
2 return `You have access to an instantdb database. When people ask for info you will provide it for
3 them by creating an instantdb query for the server to query the database. Return the query param json string only -- the json object that query is assigned to.
4 --------------------------------------------------------------------------
5 Here is an example instantdb query (the examples use an unrelated database):
6
7 Fetch namespace
555 ------------------------------------------------
556
557 Here is the schema of the instantdb database:
558
559 ${schema}

valentines_day_card_generatorget_images3 matches

@shouser•Updated 2 months ago
1import { blob } from "https://esm.town/v/std/blob";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import { DATABASE_TABLENAME } from "./constants";
4
5// export async function getImages(type: string, count: number): Promise<string[]> {
8// `
9// SELECT path
10// FROM ${DATABASE_TABLENAME}
11// WHERE type = ?
12// ORDER BY RANDOM()
32
33 for (const [type, count] of Object.entries(typeCountMap)) {
34 const query = `SELECT '${type}' as type, path FROM ${DATABASE_TABLENAME} WHERE type = ? ORDER BY RANDOM() LIMIT ?`;
35 const result = await sqlite.execute(query, [type, count]);
36 results.push(...result.rows);

valentines_day_card_generatorimage_uploader3 matches

@shouser•Updated 2 months ago
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import React, { useCallback, useRef, useState } from "https://esm.sh/react@18.2.0";
4import { DATABASE_TABLENAME } from "./constants";
5
6function App() {
179 // const KEY = new URL(import.meta.url).pathname.split("/").at(-1);
180 await sqlite.execute(`
181 CREATE TABLE IF NOT EXISTS ${DATABASE_TABLENAME} (
182 id INTEGER PRIMARY KEY AUTOINCREMENT,
183 type TEXT NOT NULL,
203 // Save metadata to SQLite
204 await sqlite.execute(
205 `INSERT INTO ${DATABASE_TABLENAME} (type, path) VALUES (?, ?)`,
206 [imageType, publicUrl],
207 );

valentines_day_card_generatorget-images2 matches

@charmaine•Updated 2 months ago
1import { blob } from "https://esm.town/v/std/blob";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import { DATABASE_TABLENAME } from "./constants";
4
5// export const manager = {
14 `
15 SELECT path
16 FROM ${DATABASE_TABLENAME}
17 WHERE type = ?
18 ORDER BY RANDOM()

valentines_day_card_generatorconstants1 match

@charmaine•Updated 2 months ago
1export const DATABASE_TABLENAME = "VALENTINES_DAY_CARD_IMGS";