Skip to content

Instantly share code, notes, and snippets.

View sloria's full-sized avatar

Steven Loria sloria

View GitHub Profile
@jacobian
jacobian / datasette-to-heroku-docker.sh
Created March 15, 2021 13:00
How to deploy Datasette to Heroku using Docker
heroku create {app} --stack container
datasette package --tag registry.heroku.com/{app}/web
docker push registry.heroku.com/{app}/web
heroku container:release -a {app} web
@zmaril
zmaril / softwarehelpskill.md
Last active August 3, 2021 04:52
I want to write software that helps kill people.

I want to write software that helps kill people.

Please, before you call the police and get my github account put on lockdown, allow me a moment to explain. What I really want to do is work on projects that advance the human condition and improve people's lives. I've been in a mad dash to learn how to program for the past four or five years exactly because I realized how much good I could do for the world with a computer.

@AndrewIngram
AndrewIngram / utils.py
Created December 10, 2021 11:43
Django on_save callback
import logging
from django.db import models, transaction
from django.db.models.signals import post_save
logger = logging.getLogger(__name__)
def on_save(obj: models.Model, callback):
"""
Attaches a one-off callback that's triggered after a Django model instance is
@AndrewIngram
AndrewIngram / 01_connections.py
Last active December 10, 2021 23:47
Strawberry Generic Connections (Python 3.10 syntax)
from typing import Generic, TypeVar
import strawberry
ConnectionNode = TypeVar("ConnectionNode")
@strawberry.type
class Edge(Generic[ConnectionNode]):
node: ConnectionNode
@jlongster
jlongster / bloop.js
Last active September 5, 2022 23:33
bloop
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
@geoffreydhuyvetters
geoffreydhuyvetters / react_fiber.md
Last active January 13, 2023 06:49
What is React Fiber? And how can I try it out today?

Most downloaded projects

SELECT
  file.project,
  COUNT(*) as total_downloads,
FROM
  TABLE_DATE_RANGE(
    [the-psf:pypi.downloads],
    TIMESTAMP("20160114"),
@zzzeek
zzzeek / sql.py
Last active August 15, 2023 10:00
The SQL is just as easy as an ORM challenge
""" "Writing SQL is just as fast as using an ORM" proof of concept
Below is a simple Python object model, where we represent a database that
stores the names of employees at a company, some of whom are "engineers",
and a list of the jobs they do and the programming languages they use.
We'd like to persist the state represented by this Python object model
in a relational database, using our Python objects as a start. Then we'd
like to write SQL queries for rows in this database, and we get back instances
of Python objects exactly as they were created.
@staltz
staltz / music.md
Last active September 29, 2023 15:42
coding music

Not for everyone. Each programmer has their own appreciation of what is good coding music.

For when I need to think deep, debug something, or design

(From most influential to least)

@QinMing
QinMing / .zshrc
Last active March 10, 2024 22:17
.zshrc (lazy loading shell functions)
# Copyright (c) 2016-2018 Ming Qin (覃明) <https://github.com/QinMing>
# Open source under MIT LICENSE.
lazy_load() {
# Act as a stub to another shell function/command. When first run, it will load the actual function/command then execute it.
# E.g. This made my zsh load 0.8 seconds faster by loading `nvm` when "nvm", "npm" or "node" is used for the first time
# $1: space separated list of alias to release after the first load
# $2: file to source
# $3: name of the command to run after it's loaded
# $4+: argv to be passed to $3