Skip to content

Instantly share code, notes, and snippets.

View matoni109's full-sized avatar

Chris matoni109

View GitHub Profile
@elle
elle / gol.rb
Last active February 27, 2022 23:24
Conway's game of life
class LiveCell
TRANSITION_RULES = {
2 => LiveCell.new,
3 => LiveCell.new,
}
def next_generation(living_neighbours_count)
TRANSITION_RULES.fetch(living_neighbours_count) { DeadCell.new }
end
end
@leastbad
leastbad / action_mailbox.md
Last active April 26, 2023 04:30
Action Mailbox: The Missing Manual

This is all you really need to know in order to make Action Mailbox work in development.

  1. Fire up ngrok http 3000 and make note of your subdomain for steps 3 and 8.
  2. Create a Mailgun account because they offer sandbox addresses; grab your domain from the Dashboard.
  3. Go into Receiving and create a catch-all route pointing to: https://XXX.ngrok.io/rails/action_mailbox/mailgun/inbound_emails/mime
  4. Add your Mailgun API key to your credentials:
action_mailbox:
 mailgun_api_key: API KEY HERE
@lesovsky
lesovsky / postrgesql-autovacuum-queue-detailed.sql
Created April 10, 2017 08:39
postrgesql-autovacuum-queue-detailed
WITH table_opts AS (
SELECT
c.oid, c.relname, c.relfrozenxid, c.relminmxid, n.nspname, array_to_string(c.reloptions, '') AS relopts
FROM pg_class c
INNER JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE c.relkind IN ('r', 't') AND n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_temp'
),
vacuum_settings AS (
SELECT
oid, relname, nspname, relfrozenxid, relminmxid,