Skip to content

Instantly share code, notes, and snippets.

@mattr
mattr / main.rb
Created May 1, 2026 03:20
ActiveModel attributes load order
# frozen_string_literal: true
if ENV['TARGET_RAILS']
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rails', ENV.fetch('TARGET_RAILS')
gem 'minitest'
end
@mattr
mattr / example.rb
Created June 8, 2022 03:17
Override model name for child classes in STI
class Example < ActiveRecord
def self.inherited(child)
child.instance_eval do
def model_name
Example.model_name
end
end
super
end
end
@mattr
mattr / AuthyToOtherAuthenticator.md
Created February 22, 2022 05:51 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

@mattr
mattr / katalyst.rb
Last active February 11, 2021 23:56
Application template for Katalyst rails projects
gem_group :development, :test do
gem "factory_bot_rails"
gem "faker"
gem "rspec-rails"
gem "simplecov", require: false
end
gem_group :development do
gem "drb"
gem "rubocop-performance"
@mattr
mattr / thoughtbot.yml
Created January 23, 2020 06:31
Updated rubocop definitions from Thoughtbot's template
AllCops:
Exclude:
- db/schema.rb
Naming/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
Enabled: false
Style/Alias:
Description: 'Use alias_method instead of alias.'

Keybase proof

I hereby claim:

  • I am mattr on github.
  • I am mattredmond (https://keybase.io/mattredmond) on keybase.
  • I have a public key ASDQ0WsPb5dzHSPujezfQI7NpYBoLNe0v4MG733lO0J9wQo

To claim this, I am signing this object:

@mattr
mattr / config.yml
Last active August 14, 2019 03:17
Circle CI configuration template
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.5-node-browsers
@mattr
mattr / .rubocop.yml
Last active January 23, 2020 06:32
Katalyst rubocop defaults
require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
# Thoughtbot template updated for latest version of Rubocop:
# https://gist.github.com/mattr/5027c436948c89d95133d06815a4a178
inherit_from: .rubocop/thoughtbot.yml
AllCops:
Verifying my Blockstack ID is secured with the address 1D8oZ98hWZfz15Fpq1GsvSSp8PH9zP7LG2 https://explorer.blockstack.org/address/1D8oZ98hWZfz15Fpq1GsvSSp8PH9zP7LG2