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/$%7Burl%7D?q=database&page=2&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 7799 results for "database"(1359ms)

reactHonoStarterREADME.md1 match

@spookyuserโ€ขUpdated 17 hours ago
21## Further resources
22
23- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.

reactHonoStarterREADME.md1 match

@n4k0m3โ€ขUpdated 18 hours ago
21## Further resources
22
23- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.

basic-html-starterindex.html38 matches

@Raazbhaiiโ€ขUpdated 18 hours ago
11 <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
12 <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-auth.js"></script>
13 <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-database.js"></script>
14 <style>
15 @keyframes float {
562 apiKey: "AIzaSyD6EXA7D77rQDQEohB52BvTYimFeTEaAho",
563 authDomain: "rn-gfx-tool.firebaseapp.com",
564 databaseURL: "https://rn-gfx-tool-default-rtdb.asia-southeast1.firebasedatabase.app",
565 projectId: "rn-gfx-tool",
566 storageBucket: "rn-gfx-tool.appspot.com",
572 firebase.initializeApp(firebaseConfig);
573 const auth = firebase.auth();
574 const database = firebase.database();
575
576 // DOM Elements
666 // Check if user is admin
667 function checkAdmin(userId) {
668 database.ref('admins/' + userId).once('value', snapshot => {
669 if (snapshot.exists()) {
670 document.getElementById('admin-link').style.display = 'block';
677 function loadUserData(userId) {
678 // Load balance and tasks
679 database.ref('users/' + userId).on('value', snapshot => {
680 const userData = snapshot.val();
681 if (userData) {
687
688 // Load tasks
689 database.ref('tasks').on('value', snapshot => {
690 const tasksContainer = document.getElementById('tasks-list');
691 tasksContainer.innerHTML = '';
727
728 // Load offers
729 database.ref('offers').on('value', snapshot => {
730 const offersContainer = document.getElementById('offers-list');
731 offersContainer.innerHTML = '';
750
751 // Load withdrawal history
752 database.ref('withdrawals').orderByChild('userId').equalTo(userId).on('value', snapshot => {
753 const historyContainer = document.getElementById('withdrawal-history');
754 historyContainer.innerHTML = '';
776
777 // Load recent activity
778 database.ref('userActivities/' + userId).limitToLast(5).on('value', snapshot => {
779 const activityContainer = document.getElementById('recent-activity');
780 activityContainer.innerHTML = '';
800
801 // Load admin stats
802 database.ref('users').once('value', snapshot => {
803 document.getElementById('total-users').textContent = snapshot.numChildren();
804 });
805
806 database.ref('withdrawals').once('value', snapshot => {
807 let total = 0;
808 snapshot.forEach(withdrawalSnapshot => {
812 });
813
814 database.ref('withdrawals').orderByChild('status').equalTo('pending').once('value', snapshot => {
815 document.getElementById('pending-requests').textContent = snapshot.numChildren();
816 });
844 displayName: username
845 }).then(() => {
846 // Create user in database
847 return database.ref('users/' + userCredential.user.uid).set({
848 username: username,
849 email: email,
850 balance: 0,
851 tasksCompleted: 0,
852 createdAt: firebase.database.ServerValue.TIMESTAMP
853 });
854 });
867 const userId = auth.currentUser.uid;
868
869 database.ref('tasks/' + taskId).once('value', taskSnapshot => {
870 const task = taskSnapshot.val();
871
872 // Update user balance
873 database.ref('users/' + userId).transaction(user => {
874 if (user) {
875 user.balance = (user.balance || 0) + task.reward;
880
881 // Record activity
882 database.ref('userActivities/' + userId).push().set({
883 type: 'task',
884 description: `Completed task: ${task.title}`,
885 amount: task.reward,
886 timestamp: firebase.database.ServerValue.TIMESTAMP
887 });
888
894 const userId = auth.currentUser.uid;
895
896 database.ref('offers/' + offerId).once('value', offerSnapshot => {
897 const offer = offerSnapshot.val();
898
900 setTimeout(() => {
901 // Update user balance
902 database.ref('users/' + userId).transaction(user => {
903 if (user) {
904 user.balance = (user.balance || 0) + offer.reward;
908
909 // Record activity
910 database.ref('userActivities/' + userId).push().set({
911 type: 'offer',
912 description: `Completed offer: ${offer.title}`,
913 amount: offer.reward,
914 timestamp: firebase.database.ServerValue.TIMESTAMP
915 });
916
938
939 // Check balance
940 database.ref('users/' + userId).once('value', snapshot => {
941 const user = snapshot.val();
942 if (user.balance < amount) {
946
947 // Deduct from balance
948 database.ref('users/' + userId).update({
949 balance: user.balance - amount
950 });
951
952 // Create withdrawal request
953 database.ref('withdrawals').push().set({
954 userId: userId,
955 amount: amount,
957 details: details,
958 status: 'pending',
959 timestamp: firebase.database.ServerValue.TIMESTAMP
960 });
961
962 // Record activity
963 database.ref('userActivities/' + userId).push().set({
964 type: 'withdrawal',
965 description: `Withdrawal request: โ‚น${amount.toFixed(2)} via ${method}`,
966 amount: -amount,
967 timestamp: firebase.database.ServerValue.TIMESTAMP
968 });
969
984 }
985
986 database.ref('tasks').push().set({
987 title: title,
988 description: description,
989 reward: reward,
990 createdAt: firebase.database.ServerValue.TIMESTAMP
991 });
992
1001 function deleteTask(taskId) {
1002 if (confirm('Are you sure you want to delete this task?')) {
1003 database.ref('tasks/' + taskId).remove();
1004 }
1005 }
1007 // Initialize sample data if empty
1008 function initializeSampleData() {
1009 database.ref('tasks').once('value', snapshot => {
1010 if (!snapshot.exists()) {
1011 const sampleTasks = [
1028
1029 sampleTasks.forEach(task => {
1030 database.ref('tasks').push().set(task);
1031 });
1032 }
1033 });
1034
1035 database.ref('offers').once('value', snapshot => {
1036 if (!snapshot.exists()) {
1037 const sampleOffers = [
1054
1055 sampleOffers.forEach(offer => {
1056 database.ref('offers').push().set(offer);
1057 });
1058 }
1060
1061 // Make first user admin
1062 database.ref('users').limitToFirst(1).once('value', snapshot => {
1063 snapshot.forEach(userSnapshot => {
1064 database.ref('admins/' + userSnapshot.key).set(true);
1065 });
1066 });

table-mountain-status-cronmain.tsx1 match

@spookyuserโ€ขUpdated 19 hours ago
14
15 const client = createClient({
16 url: Deno.env.get("TURSO_DATABASE_URL"),
17 authToken: Deno.env.get("TURSO_AUTH_TOKEN"),
18 });

reactHonoStarterREADME.md1 match

@Raazbhaiiโ€ขUpdated 21 hours ago
21## Further resources
22
23- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.

reactHonoStarterkkREADME.md1 match

@tengisโ€ขUpdated 1 day ago
21## Further resources
22
23- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.

reactHonoStarteREADME.md1 match

@tengisโ€ขUpdated 1 day ago
21## Further resources
22
23- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.

reactHonoStarterREADME.md1 match

@tengisโ€ขUpdated 1 day ago
21## Further resources
22
23- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.

factoid-triviaindex.ts3 matches

@bmitchinsonโ€ขUpdated 1 day ago
4 serveFile,
5} from "https://esm.town/v/std/utils@85-main/index.ts";
6import { runMigrations } from "./database/migrations.ts";
7import {
8 getActiveUsers,
22 getLeaderboard,
23 clearAllGameData,
24} from "./database/queries.ts";
25import type { User, GameState } from "../shared/types.ts";
26
32});
33
34// Initialize database
35await runMigrations();
36

factoid-triviaREADME.md2 matches

@bmitchinsonโ€ขUpdated 1 day ago
51โ”œโ”€โ”€ backend/
52โ”‚ โ”œโ”€โ”€ index.ts # Main Hono server with game API endpoints
53โ”‚ โ”œโ”€โ”€ database/
54โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # SQLite schema for users, facts, votes, rounds
55โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # Database query functions for game logic
56โ”‚ โ””โ”€โ”€ routes/
57โ”‚ โ””โ”€โ”€ websocket.ts # WebSocket connection handling (future)

bookmarksDatabase

@s3thiโ€ขUpdated 4 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 7 months ago