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=318&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 3475 results for "database"(532ms)

csvToSqliteUploaderREADME.md1 match

@vawogbemi•Updated 7 months ago
1Fork this val and then run, not sure if it will create the table in my database if you run this.

harshAquamarineRoostermain.tsx2 matches

@nicosql•Updated 7 months ago
5/**
6 * Every Val Town account comes with its own private
7 * [SQLite database](https://www.sqlite.org/) that
8 * is accessible from any of your vals.
9 * ([Docs ↗](https://docs.val.town/std/sqlite))
115
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,

humansnapmain.tsx2 matches

@ngmi•Updated 7 months ago
4const ADMIN_PASSWORD = Deno.env.get("ADMIN_PASSWORD") || "defaultpassword"; // Set this in your Val Town environment variables
5
6async function initializeDatabase() {
7 await sqlite.execute(`
8 CREATE TABLE IF NOT EXISTS ${KEY}_emails (
24
25export default async function server(request: Request): Promise<Response> {
26 await initializeDatabase();
27 const url = new URL(request.url);
28

sqliteExplorerAppREADME.md1 match

@nicosql•Updated 7 months 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

sqlitemain.tsx2 matches

@nicosql•Updated 7 months ago
5/**
6 * Every Val Town account comes with its own private
7 * [SQLite database](https://www.sqlite.org/) that
8 * is accessible from any of your vals.
9 * ([Docs ↗](https://docs.val.town/std/sqlite))
115
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,

sqliteExplorerAppREADME.md1 match

@florian42•Updated 7 months 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

iframeGridInfinitemain.tsx11 matches

@maxm•Updated 7 months ago
1/**
2 * This val creates an infinite grid of iframes with thick draggable borders.
3 * It includes a welcome modal, fixes the drag state issue, and stores iframe URLs in a database.
4 */
5
65 const [showModal, setShowModal] = useState(true);
66 const [iframes, setIframes] = useState([]);
67 const [urlDatabase, setUrlDatabase] = useState({});
68 const [isLoading, setIsLoading] = useState(false);
69 const gridRef = useRef(null);
86 useEffect(() => {
87 updateIframes();
88 }, [position, windowSize, urlDatabase]);
89
90 useEffect(() => {
91 loadUrlDatabase();
92 }, []);
93
131 left,
132 top,
133 url: urlDatabase[key] || '',
134 });
135 }
150 });
151 if (!response.ok) throw new Error('Failed to submit URL');
152 const updatedDatabase = await response.json();
153 setUrlDatabase(updatedDatabase);
154 } catch (error) {
155 console.error('Error submitting URL:', error);
160 };
161
162 const loadUrlDatabase = async () => {
163 try {
164 const response = await fetch('/api/load-urls');
165 if (!response.ok) throw new Error('Failed to load URLs');
166 const loadedUrls = await response.json();
167 setUrlDatabase(loadedUrls);
168 } catch (error) {
169 console.error('Error loading URLs:', error);
229
230 const result = await sqlite.execute(`SELECT * FROM ${KEY}_urls`);
231 const updatedDatabase = Object.fromEntries(result.rows.map(row => [row.key, row.url]));
232
233 return new Response(JSON.stringify(updatedDatabase), {
234 headers: { 'Content-Type': 'application/json' },
235 });

allmapsREADME.md1 match

@sammeltassen•Updated 7 months ago
1## Random Maps API
2
3This val returns one or more random rows from a [SQLite database](https://docs.val.town/std/sqlite/usage/) as a JSON array. Each item represents a digitised map from a collection and contains the following properties:
4
5```js

bikeInventorymain.tsx4 matches

@all•Updated 7 months ago
123 const initDb = async () => {
124 try {
125 const database = await init({ appId: APP_ID });
126 setDb(database);
127 console.log("InstantDB initialized successfully");
128 } catch (err) {
129 console.error("Error initializing InstantDB:", err);
130 setError(`Failed to initialize database: ${err.message}`);
131 }
132 };
166 }
167 } else {
168 setError("Database not initialized. Please refresh the page.");
169 }
170 };

sqliteExplorerAppREADME.md1 match

@flymaster•Updated 7 months 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

bookmarksDatabase

@s3thi•Updated 2 months ago

sqLiteDatabase1 file match

@ideofunk•Updated 5 months ago