This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fasthtml.common import * | |
from fastlite import Database, Table | |
from typing import List, Dict, Any | |
# Initialize FastLite database | |
db = Database("users.db") | |
Users = db.t.users | |
if not Users.exists(): | |
Users.create(id=int, name=str, email=str, pk="id") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Accessible Form with Red Asterisk</title> | |
<style> | |
/* Style the asterisk container */ | |
.required-asterisk { | |
color: red; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fasthtml.common import * | |
from fastlite import Database, Model, Field | |
from dataclasses import dataclass, fields | |
from typing import Optional | |
import sqlite3 | |
# Initialize FastHTML app with Tailwind CSS for styling | |
app = FastHTML(hdrs=(picolink, Script(src="https://cdn.tailwindcss.com"))) | |
# Initialize FastLite database |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fasthtml.common import * | |
from fastlite import * | |
from dataclasses import dataclass | |
from typing import Optional | |
# Initialize FastHTML app with PicoCSS and SQLite database | |
db = database('data/users.db') | |
app, rt = fast_app(pico=True) | |
# Define User dataclass for form data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
from functools import singledispatch | |
class Color(Enum): | |
RED = 1 | |
GREEN = 2 | |
BLUE = 3 | |
@singledispatch | |
def process(color: Color, *args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Responsive Layout</title> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List of elements | |
Element Description Categories Parents† Children Attributes Interface | |
a Hyperlink flow; phrasing*; interactive; palpable phrasing transparent* globals; href; target; download; ping; rel; hreflang; type; referrerpolicy HTMLAnchorElement | |
abbr Abbreviation flow; phrasing; palpable phrasing phrasing globals HTMLElement | |
address Contact information for a page or article element flow; palpable flow flow* globals HTMLElement | |
area Hyperlink or dead area on an image map flow; phrasing phrasing* empty globals; alt; coords; shape; href; target; download; ping; rel; referrerpolicy HTMLAreaElement | |
article Self-contained syndicatable or reusable composition flow; sectioning; palpable flow flow globals HTMLElement | |
aside Sidebar for tangentially related content flow; sectioning; palpable flow flow globals HTMLElement | |
audio Audio player flow; phrasing; embedded; interactive; palpable* phrasing source*; track*; transparent* globals; src; crossorigin; preload; autoplay; loop; muted; controls HTMLAudioElement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"*": { | |
"attributes": { | |
"accesskey": { | |
"experimental": false | |
}, | |
"anchor": { | |
"experimental": true | |
}, | |
"autocapitalize": { |
NewerOlder