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
""" | |
Safe Dictionary Value Retrieval with Dot Notation | |
This module provides a function, `safe_get`, that safely retrieves values from | |
Python dictionaries, including nested dictionaries, using either a list of keys | |
or a dot-notation string. It avoids common `KeyError` exceptions and provides | |
a default value if the specified key path is not found. | |
This code was generated with the help Gemini 2.0 Flash. Test are completly AI generated. While Gemini 2.0 Flash has been trained | |
to generate correct and efficient code, it's essential to review and test |
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
export const cache = { | |
data: new Map(), | |
timers: new Map(), | |
set: (k: string, v: any, ttl: number) => { | |
if (cache.timers.has(k)) { | |
clearTimeout(cache.timers.get(k)) | |
} | |
cache.timers.set( | |
k, | |
setTimeout(() => cache.delete(k), ttl * 1000) |
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
# httpx is a required dependency for FastHTML, feel free to substitute for something else. | |
import httpx | |
import os | |
import platform | |
# Constants and Variables | |
NAME = "" | |
CACHE_PATH = ".tailwindcss" | |
INPUT_CSS_FILE = f"{CACHE_PATH}/input.css" | |
OUTPUT_CSS_FILE = "static/css/style.css" |
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
// Inspired by Tailwind Daisy UI progress bar: https://daisyui.com/components/radial-progress/ | |
// This is a custom-made progress circular/radial progress bar with centered percentage text. | |
// Tested with Tailwind 3.x. Should work with lower versions of Tailwind CSS as well. | |
STEP 1: Add the following custom CSS: | |
.progress-ring__circle { | |
transition: stroke-dashoffset 0.35s; | |
transform: rotate(-90deg); | |
transform-origin: 50% 50%; |
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
# BASIC TKINTER CHEATSHEET | |
# Build basic GUIs with Python | |
from tkinter import * | |
from tkinter import scrolledtext | |
from tkinter import messagebox | |
from tkinter.ttk import Progressbar | |
from tkinter import filedialog | |
from tkinter import Menu |