Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lysender
lysender / htmx-allow-400-errors-swap-for-validation-errors.md
Created August 19, 2023 13:49
HTMX - Allow HTTP error 400 and 422 swap content to enable showing validation errors

Still a newbie to HTMX.

I was writing some form submit interaction and realized that HTMX won't swap/render if the HTTP status code is not 2xx.

For 404, 500 or 503 errors, I think it's fair enough.

For my use case, I'm returning error 400 or 422 for validation errors. I'm returning the form back with some error decorations for example.

According to the docs, I can change that behavior.

@hwayne
hwayne / requirements.md
Last active July 21, 2021 17:09
PBT / Example Testing comparison problem

You are writing simple budgeting softare. A Budget consists of a total limit, represented as a positive integer, and a dictionary of category limits, represented as a map from strings to integers. For example:

{
  "total_limit": 50,
  "category_limits": {
    "food": 10,
    "rent": 11,
    "candles": 49
 }
#!/usr/bin/env python3
"""
Apply database patches.
Applied patches are recorded in the schema_patch table of the database.
The dsn to connect to defaults to a local one (empty connection string). It can
be chosen using the command line or an environment variable. Patches
application is interactive by default.
@kunishi
kunishi / gist:cdfaa582ffcbe06f9da41c312f374406
Created October 4, 2017 03:28
pyenv install 3.6.2 failed on HighSierra
BUILD FAILED (OS X 10.13 using python-build 20160602)
Inspect or clean up the working tree at /var/folders/nq/5pyc_js10jz0kq7wps9b5gkm0000gn/T/python-build.20171004122245.24032
Results logged to /var/folders/nq/5pyc_js10jz0kq7wps9b5gkm0000gn/T/python-build.20171004122245.24032.log
Last 10 log lines:
import pip
File "/var/folders/nq/5pyc_js10jz0kq7wps9b5gkm0000gn/T/tmpr17v5c3y/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 26, in <module>
File "/var/folders/nq/5pyc_js10jz0kq7wps9b5gkm0000gn/T/tmpr17v5c3y/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 27, in <module>
File "/var/folders/nq/5pyc_js10jz0kq7wps9b5gkm0000gn/T/tmpr17v5c3y/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 35, in <module>
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active April 22, 2024 04:43 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@JMichaelTX
JMichaelTX / JXA Resources.md
Last active March 31, 2024 04:38
JavaScript for Automation (JXA) Resources

JXA Resources

Revised: 2019-11-28 16:16 GMT-6

JXA

This is a list of the key resources I have found useful. If you know of others, please post in a comment below, and I will add to this list.

I have tried to order this list in the order that, to me, is best for learning JXA from scratch. We all learn a bit diferently, so adjust to suit your style/needs. Please post if you have suggestions on learning JXA.

@micxjo
micxjo / day15.py
Last active December 7, 2018 21:36
import sys
from os import abort
from ortools.constraint_solver import pywrapcp
def day15(path, calorie_total=None):
solver = pywrapcp.Solver('AOC Day 15')
values = range(0, 100)
@isao
isao / Nginx Configuration.plist
Last active March 6, 2024 07:16
(wip) BBEdit Codeless Language Module for Nginx Configuration files
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--
BBEdit codeless language module for nginx configs.
Requires BBEdit 8.0 or higher. To install, copy here:
~/Library/Application Support/BBEdit/Language Modules/
and relaunch BBEdit.
set deviceID to (do shell script "diskutil list | awk '/YourBootcampPartition/ {print $NF}'")
do shell script "sudo bless -device /dev/" & deviceID & " -legacy -setBoot -nextonly"
tell application "Finder" to restart
@ccstone
ccstone / BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
Last active March 30, 2024 07:53
BBEdit-TextWrangler Regular Expression Cheat-Sheet
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEdit / BBEdit-Lite / TextWrangler Regular Expression Guide Modified: 2018/08/10 01:19
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.