Skip to content

Instantly share code, notes, and snippets.

View joshuadavidthomas's full-sized avatar

Josh Thomas joshuadavidthomas

View GitHub Profile
Postgres Internals
Djangocon US 2024
Elizabeth Christensen
## psql basics
--whoami
\conninfo
--user list
# myapp/management/commands/make_smoke_tests.py
from django.core.management.base import BaseCommand
from django.urls import get_resolver, URLPattern, URLResolver
import re
import os
class Command(BaseCommand):
help = 'Generates smoke tests for projects.'
def add_arguments(self, parser):
import { reactive } from '@vue/reactivity'
function switchboard(value) {
let lookup = {}
let current
let get = () => current
let set = (newValue) => {
@randerzander
randerzander / football.css
Last active December 24, 2024 11:20
Terminal UI for displaying live college or nfl game status
Game {
height: 3;
width: 50%;
}
@djm
djm / .envrc
Created September 20, 2022 23:17
YunoJuno Nix Developer Environment
export OP_ACCOUNT=yunojuno.1password.com
# Create .env.local if it does not exist
if [ ! -f .env.local ]
then
echo "Creating .env.local"
cat <<EOF > .env.local
# Place secret env variables from 1Password and custom overrides here
#
# Any variables here will override ones set in .env.native.dist
@cameronmcefee
cameronmcefee / ! Use Sentry with Astro.md
Last active June 21, 2023 11:19
Here's a way to get Sentry working in framework components with Astro.

This example isn't comprehensive, so you can't just copy and paste. However, it should be a good template to base your own solution off. I chose to use React but you can use any framework.

Note: Sentry has a Vite plugin. As of Astro 1.9.0, Astro runs Vite plugins twice during the build process, which results in map files being submitted twice. Until this is resolved, it doesn't seem like an acceptable solution.

@AndrewIngram
AndrewIngram / usage.py
Last active June 30, 2022 11:57
Python Entity or ID Pattern
def my_fun(user_or_id: UserOrId):
user = get_user(user_or_id)
# Do something with user
# These both do the same thing (but the first avoids the extra db hit)
my_fun(user)
my_fun(user.id)
@EllyLoel
EllyLoel / reset.css
Last active January 24, 2025 09:14
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@pvanliefland
pvanliefland / README.md
Last active July 16, 2024 11:25
Django embed template tag

embed template tag

Rationale

The issue

When working on a web application, you may have, on different screens, a variable number of similar components with minor differences. A "card" component is a good example: every card has a wrapper section element, a title, and an arbitrary content wrapped inside a div element.

Consider the following simplified HTML example of an application :

@walkermatt
walkermatt / README.md
Last active October 30, 2023 13:57
Chalice Dev AWS IAM Policy

Chalice Dev AWS IAM Policy

AWS IAM Policy suitable for assigning to a user developing Chalice applications. Allows the developer sucessfully execute chalice deploy, chalice delete and chalice logs

Derived from comments on chalice/issues/59, extended by trial and error :-)

Subsitute YOUR-AWS-REGION in chalice-dev-iam-policy.json with the region you are deploying to, for example eu-west-1.

AWS profiles