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
functionExercisemain.tsx4 matches
1// make a function, a variable containing a function, block body arrow function,
2// and concise body syntax arrow function
34function adder(num1, num2) {
5return num1 + num2;
6}
8adder(1, 2);
910let subtracter = function minus(num1, num2) {
11return num1 - num2;
12};
sharpCoralCoyotemain.tsx1 match
23return quotes
2425# Test the function
26quotes = get_quotes()
27print(random.choice(quotes))
petunia_chatmain.tsx4 matches
109const errorDisplay = document.getElementById('error-display');
110111function logError(message) {
112console.error(message);
113errorDisplay.textContent = message;
114}
115116async function sendMessage() {
117const message = userInput.value.trim();
118if (!message) {
244const refreshButton = document.getElementById('refresh-market');
245246function createMarketStatHTML(emoji, name, trend, value) {
247const div = document.createElement('div');
248div.className = 'market-stat';
260}
261262async function fetchMarketInsights() {
263try {
264const response = await fetch('/market-data', {
forEmulated1main.tsx4 matches
5import imageCompression from "https://esm.sh/browser-image-compression";
67function App() {
8const [generatedCode, setGeneratedCode] = useState('');
9const [codeHistory, setCodeHistory] = useState([]);
310}
311312function client() {
313createRoot(document.getElementById("root")).render(<App />);
314}
315if (typeof document !== "undefined") { client(); }
316317function getCurrentYear() {
318return new Date().getFullYear();
319}
320321export default async function server(request: Request): Promise<Response> {
322if (request.method === 'POST' && new URL(request.url).pathname === '/generate-landing-page') {
323try {
twitterAlertmain.tsx2 matches
14.join(" OR ") + " " + excludes;
1516function relevant(t: Tweet) {
17const lowercaseText = t.full_text?.toLowerCase() || "";
1828const isProd = true;
2930export async function twitterAlert({ lastRunAt }: Interval) {
31// search
32const since = isProd
functionExerciseREADME.md1 match
1Migrated from folder: fullstackJavaScriptIntro/archiveFullstackJavaScriptIntro/functionExercise
15// console.log(MEUS_JOGOS);
1617function compareGames(drawnNumbers, userGame) {
18return userGame.filter(num => drawnNumbers.includes(num)).length;
19}
2021function TabelaDistribuicaoPremios({ premios }) {
22if (!premios || premios.length === 0) return null;
2351}
5253function App() {
54const [dadosLoteria, setDadosLoteria] = useState(null);
55const [numeroAtual, setNumeroAtual] = useState(null);
56const [erro, setErro] = useState(null);
5758async function buscarDadosLoteria(numero = null) {
59const url = numero
60? `https://servicebus2.caixa.gov.br/portaldeloterias/api/megasena/${numero}`
195}
196197function client() {
198createRoot(document.getElementById("root")).render(<App />);
199}
200if (typeof document !== "undefined") { client(); }
201202export default async function server(request: Request): Promise<Response> {
203return new Response(
204`
laudableTurquoiseOpossummain.tsx5 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45function App() {
6const [user, setUser] = useState(null);
7const [view, setView] = useState("login");
202}
203204function LoginForm({ onLogin, onSignupView }) {
205const [username, setUsername] = useState('');
206const [password, setPassword] = useState('');
252}
253254function SignupForm({ onSignup, onLoginView }) {
255const [username, setUsername] = useState('');
256const [password, setPassword] = useState('');
322// Rest of the components remain the same as in the previous implementation
323324function client() {
325createRoot(document.getElementById("root")).render(<App />);
326}
328if (typeof document !== "undefined") { client(); }
329330export default async function server(request: Request): Promise<Response> {
331const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
332const KEY = "laudableTurquoiseOpossum";
14}
1516function normalizeAddress(address: string): string {
17return address.toLowerCase();
18}
1920async function initializeDatabase() {
21await sqlite.execute(`
22CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
27}
2829async function getBalance(address: string): Promise<number> {
30const normalizedAddress = normalizeAddress(address);
31const result = await sqlite.execute(
40}
4142async function setBalance(address: string, amount: number) {
43const normalizedAddress = normalizeAddress(address);
44await sqlite.execute(
49}
5051async function incrementBalance(address: string, amount: number) {
52const normalizedAddress = normalizeAddress(address);
53await sqlite.execute(
58}
5960async function decrementBalance(address: string, amount: number) {
61await incrementBalance(address, -amount);
62}
6364async function getAllAccounts(): Promise<{ address: string; balance: number }[]> {
65const result = await sqlite.execute(`SELECT address, balance FROM ${TABLE_NAME}`);
66return result.rows.map(row => ({ address: String(row.address), balance: Number(row.balance) }));
67}
6869async function mint(address: string, amount: number) {
70await incrementBalance(address, amount);
71}
7273function generateInstructions(baseUrl: string): string {
74return `
75<html>
131}
132133function handleHome(baseUrl: string): ApiResponse {
134return {
135status: 200,
139}
140141async function handleBalance(address: string | null): Promise<ApiResponse> {
142if (!address) {
143return {
153}
154155async function handleSend(data: any): Promise<ApiResponse> {
156const { from, to, amount } = data;
157if (!from || !to || amount === undefined) {
193}
194195async function handleAccounts(): Promise<ApiResponse> {
196const accounts = await getAllAccounts();
197return {
201}
202203async function handleMint(data: any, authHeader: string | null): Promise<ApiResponse> {
204const { address, amount } = data;
205if (!address || amount === undefined) {
235}
236237function handleFavicon(): ApiResponse {
238return {
239status: 204,
242}
243244function handleNotFound(): ApiResponse {
245return {
246status: 404,
249}
250251function logRequestResponse(req: Request, res: ApiResponse) {
252console.log(`Request: ${req.method} ${req.url}`);
253console.log(`Response: Status ${res.status}, Body:`, res.body);
254}
255256export default async function(req: Request): Promise<Response> {
257await initializeDatabase();
258