greenLobstermain.tsx1 match
1// View at https://andreterron-htmlExample.web.val.run?name=Andre
2export default async function(req: Request): Promise<Response> {
3const query = new URL(req.url).searchParams;
4
11user: "website that shows the current time",
12content: `/** @jsxImportSource npm:react */
13export default function() {
14return <h1>{new Date().toLocaleTimeString()}</h1>;
15}`,
91);
92});
93export async function compile(description: string) {
94const messages = [
95{
sudoku_solver_exact_covermain.tsx4 matches
86};
8788function slotToConstraints(slot: Slot): Constraint[] {
89console.assert(slot.row >= 0 && slot.row <= 8);
90console.assert(slot.col >= 0 && slot.col <= 8);
100}
101102function constraintsToSlot(constraints: Constraint[]): Slot {
103console.assert(constraints.length === 4);
104let row = null;
136}
137138function cIndex(constraint: Constraint): number {
139switch (constraint.kind) {
140case "slot":
347}
348349export function solve(sudoku: Sudoku): Sudoku | null {
350sudoku = Sudoku.parse(sudoku);
351const matrix = new Matrix();
falImageHandlermain.tsx1 match
6});
78export default async function(req: Request): Promise<Response> {
9const { prompt } = await req.json();
10
6};
78export default async function(req: Request): Promise<Response> {
9let key = new URL(req.url).pathname;
10let url = await blob.getJSON(genKey(key));
falImageGenmain.tsx1 match
5* @returns {Promise<string>} A promise that resolves to the URL of the image.
6*/
7export async function generateImage(
8input: string,
9): Promise<{ url: string }> {
34// Fetch user by username
5export async function getUserByUsername(username: string) {
6const userResult = await sqlite.execute({
7sql: `SELECT id, name, bio, username, email, location, currently_listening, currently_reading_title,
2930// Update user profile
31export async function updateUser(userId, name, bio, location, currentlyListening, currentlyReading, currentlyWatching, profile_theme, profile_img) {
32if (typeof userId !== "number") {
33throw new Error("userId must be a number.");
46}
4748export async function insertUserLink(userId: number, label: string, url: string) {
49await sqlite.execute({
50sql: `INSERT INTO user_links (user_id, label, url) VALUES (?, ?, ?)`,
53}
5455export async function getLinkById(linkId: number) {
56const result = await sqlite.execute({
57sql: `SELECT id, label, url, user_id FROM user_links WHERE id = ?`,
68}
6970export async function updateUserLink(linkId: number, label: string, url: string) {
71await sqlite.execute({
72sql: `UPDATE user_links SET label = ?, url = ? WHERE id = ?`,
75}
7677export async function deleteUserLink(linkId: number, userId: number) {
78await sqlite.execute({
79sql: `DELETE FROM user_links WHERE id = ? AND user_id = ?`,
82}
8384export async function getUserLinks(userId) {
85if (typeof userId !== "number") {
86throw new Error("userId must be a number.");
101}
102103export async function isUsernameTaken(username) {
104const result = await sqlite.execute({
105sql: `SELECT COUNT(*) FROM users WHERE username = ?`,
110}
111112export async function isEmailTaken(email) {
113const result = await sqlite.execute({
114sql: `SELECT COUNT(*) FROM users WHERE email = ?`,
140141142export async function getProfileImageUrl(username) {
143const key = `profile_img/${username}`;
144const imageUrl = await blob.get(key);
4// Make SQLite table to store the count increments (with timestamps)
56export default async function(req: Request): Promise<Response> {
7const result = await sqlite.batch([
8"CREATE TABLE IF NOT EXISTS counter_2_baby (timestamp DATETIME DEFAULT CURRENT_TIMESTAMP)",
getCloudLabCountmain.tsx1 match
4// TODO: Convert to sqlite
56export default async function(req: Request): Promise<Response> {
7const result = await sqlite.execute(
8"SELECT COUNT(*) FROM counter_2_baby",