Skip to content

Instantly share code, notes, and snippets.

View caffeinatedMike's full-sized avatar
🫠
Stuck in a perpetual state of existential crisis

Michael Hill caffeinatedMike

🫠
Stuck in a perpetual state of existential crisis
View GitHub Profile
@M0r13n
M0r13n / render.html
Last active October 6, 2023 06:32
A sample Wtforms field for creating a list of tags with custom separators, e.g. "," or " ".
<form action="" method="POST" role="form" class="form">
{{ form.hidden_tag() }}
<!--Other fields-->
{{ wtf.form_field(form.tags, placeholder='audio, hardware, chip') }}
<button class="btn btn-success" type="submit">submit</button>
</form>
@rms1000watt
rms1000watt / jinja2-omit-comma-from-item.txt.j2
Created October 18, 2019 21:10
Jinja2 omit comma from last item in list
# Courtesy of: https://stackoverflow.com/a/11974399
{%- for item in items %}
[
"{{item}}"{{ "," if not loop.last }}
]
{%- endfor %}
@jefftriplett
jefftriplett / python-django-postgres-ci.yml
Last active March 27, 2024 04:27
This is a good starting point for getting Python, Django, Postgres running as a service, pytest, black, and pip caching rolling with GitHub Actions.
name: CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
services:
@vulcan25
vulcan25 / README.md
Last active July 7, 2024 12:52
Flask + sqlalchemy declarative base example

TODO: write readme

@finnmglas
finnmglas / bootstrap-shields-badges.html
Last active September 4, 2024 23:13
Bootstrap badges like on shields.io
<!-- Create badges / shields like on shields.io
-- but with bootstrap.
--
-- Fully adjustable, use this for whatever you want ^^
--
-- Finn M Glas, 2020-07-06
-->
<!-- Regular badges (value-only) -->
@m4rk4
m4rk4 / espn-fcast
Created October 30, 2020 01:53
espn-fcast
var socket;
var fcastUrl;
fetch('https://fastcast.semfs.engsvc.go.com/public/websockethost')
.then(
function(response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' + response.status);
return;
}
@ivangeorgiev
ivangeorgiev / README.md
Last active May 7, 2025 18:12
Python Subclass Factory

Python Subclass Factory

How to implement subclass-based plugin architecture? How to handle polymorphism from persisted data?

@e-kondr01
e-kondr01 / README.md
Last active May 3, 2025 12:45
Pytest + FastAPI + Async SQLAlchemy

Run API tests with Pytest, FastAPI and Async SQLAlchemy. Changes made in test functions are not persisted to DB, even if await session.commit() is called. This allows tests to be independent, able to run in parallel or in a shuffled order without affecting the result.

This snippet does not include creation of DB tables, as I use Alembic for migration management and advise you to do the same (even in tests).

@shiningflash
shiningflash / advance_pydantic.md
Created March 23, 2024 17:25
Advanced Pydantic Usage Guide

Advanced Pydantic Usage Guide

Introduction

This guide explores advanced features of Pydantic, a powerful library for data validation and settings management in Python, leveraging type annotations. Aimed at enhancing backend development, it covers complex usage patterns, custom validation techniques, and integration strategies.

For basic user guide, follow the official documentation.

Custom Validators