sqliteExplorerAppREADME.md1 match
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
1213// Scrapes the stencil fairs website and gets the upcoming events
14async function scrapeWebsiteAndGetEvents(url: string): Promise<Array<Event>> {
15const response = await fetch(url);
16if (!response.ok) {
4445// Checks whether a given event already exists in the database
46async function doesEventExist(eventName: string): Promise<boolean> {
47const result = await sqlite.execute({
48sql: `select * from stencil_fairs where name = :eventName`,
52}
5354// This is the function that is called via the Cron job
55// It gets all the upcoming events from the website
56// Then it checks if there are any new ones by checking whether all the upcoming events are already in our db
57// If there are any new ones, it saves them to the db and sends a notification email
58export default async function(interval: Interval) {
59try {
60const upcomingEvents = await scrapeWebsiteAndGetEvents(WEBSITE_URL);
flutteringVioletBirdmain.tsx4 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45function App() {
6const [description, setDescription] = useState("Thu, Sep 26, 2024 2:25 PM EDT");
7const [dateString, setDateString] = useState("2024-09-26T14:25:00-04:00");
77}
7879function DateComponent({ dateString }) {
80if (!dateString) {
81return <div>Invalid date string provided</div>;
107);
108109function client() {
110createRoot(document.getElementById("root")).render(<App />);
111}
115}
116117export default async function server(request: Request): Promise<Response> {
118return new Response(`
119<!DOCTYPE html>
newUserWelcomeEmailmain.tsx2 matches
4import { html } from "https://esm.town/v/stevekrouse/html";
56async function sendTownieEmail() {
7try {
8await email({
19}
2021export async function newUserWelcomeEmail(req: Request): Promise<Response> {
22if (req.method === "GET") return html(welcomeEmail);
23if (req.headers.get("clerkNonSensitive") !== Deno.env.get("clerkNonSensitive"))
14// console.log(await redis.get("json-ex-1"));
1516// Export a function that returns the redis client
17export function get_redis() {
18return redis;
19}
upstash_incmain.tsx2 matches
3const redis = get_redis();
45// Function to increment and get the count
6export async function incrementCount() {
7return await redis.incr("count");
8}
timeCalculatormain.tsx9 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45function TimeInput({ value, onChange, placeholder }) {
6const handleChange = (e) => {
7let newValue = e.target.value.replace(/\D/g, '').slice(0, 4);
30}
3132function TimeRow({ index, startTime, endTime, subtractFullDay, onChange, fullDayHours }) {
33const duration = calculateTimeDifference(startTime, endTime, subtractFullDay, fullDayHours);
34const isNegative = duration.startsWith('-');
56}
5758function calculateTimeDifference(start, end, subtractFullDay, fullDayHours) {
59if (start.length !== 4 || end.length !== 4) return "";
60
82}
8384function calculateTotalDuration(rows, fullDayHours) {
85let totalMinutes = 0;
86rows.forEach(row => {
99}
100101function saveToQueryParams(rows, fullDayHours) {
102const params = new URLSearchParams();
103params.append('fullDayHours', fullDayHours);
110}
111112function loadFromQueryParams() {
113const params = new URLSearchParams(window.location.search);
114const rows = [];
128}
129130function App() {
131const [rows, setRows] = useState([{ start: "", end: "", subtractFullDay: false }]);
132const [fullDayHours, setFullDayHours] = useState(8);
201}
202203function client() {
204createRoot(document.getElementById("root")).render(<App />);
205}
209}
210211export default async function server(request: Request): Promise<Response> {
212return new Response(`
213<!DOCTYPE html>
whackaghostmain.tsx12 matches
44* HomeButton component - Renders a button to return to the home screen
45* @param {Object} props - Component props
46* @param {Function} props.onClick - Function to handle button click
47*/
48function HomeButton({ onClick }) {
49return (
50<button className="home-button" onClick={onClick}>
57* SpookyMessage component - Displays a game over message with a ghost animation
58* @param {Object} props - Component props
59* @param {Function} props.onHomeClick - Function to handle home button click
60* @param {boolean} props.isTimeOut - Whether the game ended due to timeout
61* @param {number} props.score - The player's final score
63* @param {boolean} props.isWin - Whether the player has won the game
64*/
65function SpookyMessage({ onHomeClick, isTimeOut, score, isTooManyWrongClicks, isWin }) {
66console.log("SpookyMessage rendered. isWin:", isWin, "score:", score);
67return (
83* GameDescription component - Displays game instructions and rules
84*/
85function GameDescription() {
86return (
87<div className="game-description">
109* Main App component for the Whack-a-Ghost game
110*/
111function App() {
112const [score, setScore] = useState(0);
113const [activeGhost, setActiveGhost] = useState(-1);
314315/**
316* Client-side rendering function
317*/
318export function client() {
319const rootElement = document.getElementById("root");
320if (rootElement) {
328329/**
330* Server-side rendering function
331* @param {Request} request - The incoming request object
332* @returns {Promise<Response>} The response object with the HTML content
333*/
334export default async function server(request: Request): Promise<Response> {
335return new Response(
336`
350import { client } from "${import.meta.url}";
351window.addEventListener("load", () => {
352if (typeof client === "function") {
353client();
354} else {
355console.error("Client function not found");
356}
357});
10import { html } from "https://esm.town/v/stevekrouse/html";
1112export default async function(req: Request) {
13let handler = createStaticHandler(routes);
14let context = await handler.query(req);
runescapeWoodCuttingmain.tsx4 matches
9};
1011function LoginScreen({ onLogin }) {
12const [name, setName] = useState("");
1336}
3738function App() {
39const [playerName, setPlayerName] = useState("");
40const [skill, setSkill] = useState("woodcutting");
107}
108109function client() {
110createRoot(document.getElementById("root")).render(<App />);
111}
115}
116117export default async function server(request: Request): Promise<Response> {
118const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
119const SCHEMA_VERSION = 2;