Skip to content

Instantly share code, notes, and snippets.

View DRBragg's full-sized avatar

Drew Bragg DRBragg

View GitHub Profile
@andynu
andynu / example.sh
Last active January 19, 2023 16:40
rails-upgrade script, a helper for moving pins and doing other checks during ruby upgrades
# I have lots of projects. As I do the rails upgrades I collect the pin changes and other adjustments here
# towards the end of upgrading all the projects it gets easier and easier because of these commands.
❯ ./rails-upgrade
Commands:
rails-upgrade apple_touch # add blank apple-touch icons
rails-upgrade application_record # adds ApplicationRecord and replaces all references to ActiveRecord::Base with it
rails-upgrade asset_precompile_check # look for assets that need to be added to the assets initializer precompile list
rails-upgrade assigns_check # the assigns method has been extracted to a gem, check if it is used, and add the gem
rails-upgrade before_filter # change before_filter to before_action in controllers
@matschaffer
matschaffer / notes.md
Created April 13, 2022 01:58
2022-04-phillyrb-pubnite.txt
  • banking and crypto pains
  • going indy
  • new jobs
  • salary bands & hiring negotiations
  • market hiring data & finding market data
  • Atlanta rb and Tech404
  • Old Philly user group history: philly lambda, algorithmics, ibm
  • Listening and repeating tech stuff - fake it till you make it
  • SinCity Ruby - Vegas, _why talks
  • updated version of the rubykaigi 2021 talk https://rubykaigi.org/2021-takeout/presentations/schwad4hd14.html
@stevepolitodesign
stevepolitodesign / example.md
Last active April 15, 2022 21:59
Send secure messages in Rails. Work in progress.
# app/controllers/secret_messages_controller.rb
class SecretMessagesController < ApplicationController
  def create
    @secret_message_form = SecretMessageForm.new(secret_message_form_params)

    if @secret_message_form.valid?
      encrypted_content = encrypt_content(
        seed_phrase: params[:secret_message_form][:seed_phrase],
        password: params[:secret_message_form][:password],
const minute = 60;
const hour = minute * 60;
const day = hour * 24;
const week = day * 7;
const month = day * 30;
const year = day * 365;
/**
* Convert a date to a relative time string, such as
* "a minute ago", "in 2 hours", "yesterday", "3 months ago", etc.
@sergeyzenchenko
sergeyzenchenko / russia-ddos.md
Last active October 14, 2024 20:06
Russia DDOS list
@kddnewton
kddnewton / wordle.rb
Last active January 23, 2022 08:45
Wordle solver
words = []
letters = ("a".."z").to_a
File.foreach("/usr/share/dict/words", chomp: true) do |word|
words << word.downcase if word.match?(/\A[a-z]{5}\z/i)
end
while words.length > 1
weights = letters.to_h { |letter| [letter, 0] }
words.each do |word|
# Rails production setup via SQLite3 made durable by https://litestream.io/
# Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine.
#
# try locally: docker build . -t rails && docker run -p3000:3000 -it rails
#
# in production you might want to map /data to somewhere on the host,
# but you don't have to!
#
FROM ruby:3.0.2
@yahonda
yahonda / ruby31onrails.md
Last active April 15, 2025 20:01
Ruby 3.1 on Rails

Ruby 3.1 on Rails

Actions required to use Ruby 3.1.0 with Rails

Rails 7.0.Z

  • Rails 7.0.1 is compatible with Ruby 3.1.0.
  • Rails 7.0.1 addes net-smtp, net-imap and net-pop gems as Action Mailbox and Action Mailer dependency, you do not need to add them explicitly in your application Gemfile anymore.
  • thor 1.2.1 has been released. You will not see DidYouMean::SPELL_CHECKERS.merge deprecate warnings anymore.

Rails 6.1.Z

  • Use Rails 6.1.5 to support database.yml with aliases and secrets.yml with aliases.
@davidteren
davidteren / respawn
Last active July 13, 2023 00:57
Script to update dependencies and reset the db.
#!/usr/bin/env ruby
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end