Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

23 total results found

Coding

A collection of coding tools, best practices, habits, commands

Linting

Coding

Formatting

Coding

HTMX

Coding

Litestar Webserver

Coding

SQL Tips and Tricks

Coding

Testing

Coding

Svelte & Typescript

Coding

Testing (pytest)

Coding Testing

Intro Additional info https://docs.pytest.org/en/stable/explanation/anatomy.html Initial setup In your pyproject.toml file, make sure to [tool.pytest.ini_options] # Your project files will be in `src/` pythonpath = "src" # Your test files can be found in `test...

HTML

Coding Linting

HTML linting can be done with djlint

HTML

Coding Formatting

Auto format with djlint To auto-format HTML files, you can run uv run djlint . --reformat Ignore code To exclude code from formatting, see ignoring-code

OOB Swap

Coding HTMX

With OOB Swap I mean swapping multiple elements at once, which may come from multiple template files Example index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"...

Jinja - useful commands

Coding HTMX

https://jinja.palletsprojects.com/en/stable/templates/ TODO if elif else for loop if defined

Input

Coding Litestar Webserver

required (positional) parameteres optional parameters (?foo=bar) read user cookies Post request with data HTMLX elements may have a "name" field which will be the 'key'-name in the data object. On the litestar server, the post request endpoint will receive a d...

Tips and Tricks

Coding SQL Tips and Tricks

Data types Window functions Window functions are functions that grab additional data per row, e.g. row_number() which adds a row number from the order by clause. Values COALESCE(value1, ..., default_value) returns the first argument that is not null. CASE allo...

Postgres - Piccolo (Python) hints

Coding SQL Tips and Tricks

Piccolo column types Postgres column types Postgres type Python type Piccolo type Python example timestamptz datetime.datetime Timestamptz(required=True) with timezone arrow.utcnow().datetime timestamp(3) or timestamp(6) datetime.datetime Timestamp(re...

Testing (playwright)

Coding Testing

How to test Click X, then Y, then Z. Finally, assert that XYZ is visible on the page. Finding elements Locators API methods on locators page.get_by_role("checkbox", name="Subscribe").check() page.get_by_role("button", name=re.compile("submit", re.IGNORECASE))....

Testing (svelte)

Coding Testing

TODO

Test strategy

Coding Testing

What to test? In the other chapters it is described how to test (pytest, playwright for frontend, svelte unit tests). This chapter discusses, what exactly should be tested, and what should not. What to test What not to test Libraries We expect libraries to hav...

HTML and JS

Coding HTMX

You can use // @ts-check at the top of a <script> tag to get typescript support in VScode. Use // @ts-ignore to hide an error.

Basics

Coding SQL Tips and Tricks

Snippets Check if database exists Postgres SELECT EXISTS ( SELECT 1 FROM pg_database WHERE datname = 'your_database_name' ) AS database_exists; MariaDB SELECT EXISTS ( SELECT 1 FROM information_schema.schemata WHERE schema_name = 'yo...

Svelte Concepts

Coding Svelte & Typescript

Basics Variables https://svelte.dev/docs/svelte/$state https://svelte.dev/docs/svelte/$derived let state_var = $state(start_value) let derived_var = $derived(state_var * 2) let derived_var_by_func = $derived.by(() => { // For more complicated logic return ...

Typescript

Coding Svelte & Typescript

Types Usually when defining types, you would want to create your own types file types.ts <prefix>.types.ts or <prefix>_types.ts Tips and Tricks TODO Array Start by defining an array (as constant) to be able to extract the type afterwards. const my_items = ["ap...