rbenv install 2.7.1
Downloading ruby-2.7.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2
Installing ruby-2.7.1...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 12.4 using ruby-build 20220713)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'benchmark' | |
def make_request(sleep_mins, read_timeout = 1) | |
puts "sleep_mins=#{sleep_mins} mins read_timeout=#{read_timeout} mins" | |
uri = URI.parse 'http://localhost:4040' | |
request = Net::HTTP::Get.new("/sleep?m=#{sleep_mins}") | |
Net::HTTP.start(uri.host, uri.port, read_timeout: (read_timeout * 60)) do |http| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'awesome_print' | |
AwesomePrint.irb! | |
rescue LoadError | |
Gem.install('awesome_print') | |
retry | |
end | |
ap '👋🌎' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :export do | |
desc <<-DESC.strip_heredoc | |
Export tables listed as YAML | |
Usage: `rails export:tables TABLES=users,posts,comments` | |
DESC | |
task tables: :environment do | |
models = ENV["TABLES"].split(",").map do |name| | |
name.to_s.classify.constantize | |
rescue NameError | |
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# rubocop:disable | |
def puts_here(stuff = nil) | |
black_background_white_text = "\e[30;47m" | |
reset = "\e[0m" | |
puts([black_background_white_text, "*" * 20, self.class.name, "---", caller(1..1).first, "*" * 20, reset].join(" ")) | |
if block_given? | |
yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" asdf install ruby 2.6.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/^((AC|ZC|FC|GE|LP|OC|SE|SA|SZ|SF|GS|SL|SO|SC|ES|NA|NZ|NF|GN|NL|NC|R0|NI|EN|\d{2}|SG|FE)\d{5}(\d|C|R))|((RS|SO)\d{3}(\d{3}|\d{2}[WSRCZF]|\d(FI|RS|SA|IP|US|EN|AS)|CUS))|((NI|SL)\d{5}[\dA])|(OC(([\dP]{5}[CWERTB])|([\dP]{4}(OC|CU))))$/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails new app_name \ | |
--database=postgresql \ | |
--skip-action-cable --skip-action-mailer --skip-active-storage \ | |
--skip-sprockets --skip-action-mailbox --skip-action-text \ | |
--skip-bundle --skip-keeps --skip-spring --skip-test \ | |
--skip-coffee --skip-system-test --skip-turbolinks | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md | |
docker run -d \ | |
--name pihole \ | |
-p 53:53/tcp -p 53:53/udp \ | |
-p 80:80 \ | |
-p 443:443 \ | |
-e TZ="Europe/London" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
linters: | |
LineLength: | |
max: 40 |
NewerOlder