Skip to content

Instantly share code, notes, and snippets.

View eadz's full-sized avatar

Eaden McKee eadz

View GitHub Profile
@eadz
eadz / ruby-redux.rb
Last active October 4, 2022 21:24
Redux in Ruby
# Redux in Ruby
class Store
attr_reader :state
def initialize(initial_state, *reducers)
@reducers = reducers
@state = initial_state || {}
end
@eadz
eadz / accounting.sql
Created February 16, 2023 04:48 — forked from 001101/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@eadz
eadz / supervisor.rb
Created July 10, 2023 09:32
Supervisor - 0 downtime deployments
# No Downtime Deploys
# to setup
# clone your app in ~/app-a and ~/app-b
# use the following caddy server config
# yourdomain.com {
# reverse_proxy * {
# to http://127.0.0.1:4210 http://127.0.0.1:4220
# header_up +Host yourdomain.com
# header_up -X-Forwarded-Host
# health_uri /up