This document is for people using an Apple MacBook based on the Apple ARM architecture, ie. M1 or newer, who wants to run Ruby on Rails applications that does not work on the ARM architecture. The current use case is applications using Oracles instant client libraries which are not ARM compatible.
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
Enum.reduce_while(list, [], fn x, acc -> | |
if Enum.member?(acc, x), do: {:halt, x}, else: {:cont, [x | acc]} | |
end) |
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
$ docker build . | |
Sending build context to Docker daemon 95.05MB | |
... | |
Step 16/42 : WORKDIR /app | |
---> Using cache | |
---> 6169e33fecef | |
Step 17/42 : RUN apt-get update | |
---> Running in 4805303d6953 | |
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB] |
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
I, [2020-03-07T14:40:36.587947 #90282] INFO -- : *** Threaded *** | |
I, [2020-03-07T14:40:36.588335 #90282] INFO -- : Still running | |
I, [2020-03-07T14:40:36.588399 #90282] INFO -- : Start Nokogiri | |
I, [2020-03-07T14:40:36.588566 #90282] INFO -- : Start Nokogiri | |
I, [2020-03-07T14:40:36.589041 #90282] INFO -- : Start Nokogiri | |
I, [2020-03-07T14:40:36.589079 #90282] INFO -- : Start Nokogiri | |
I, [2020-03-07T14:40:36.589113 #90282] INFO -- : Start Nokogiri | |
I, [2020-03-07T14:40:36.589138 #90282] INFO -- : Start Nokogiri | |
I, [2020-03-07T14:40:36.589157 #90282] INFO -- : Start Nokogiri | |
I, [2020-03-07T14:40:36.589175 #90282] INFO -- : Start Nokogiri |
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
# The prepare stage extracts the versions of some heavy gems into | |
# individual files enabling us to preinstall these gems in the build stage | |
# below. Thus we won't have to install the heavy gems everytime the | |
# Gemfile.lock changes, only when heavy gem versions are changed. | |
FROM ruby:2.6.3 AS prepare | |
RUN mkdir /gem_versions | |
COPY Gemfile.lock /gem_versions/Gemfile.lock | |
RUN grep "^ nokogiri " /gem_versions/Gemfile.lock | awk -F '[()]' '{print $2}' > /gem_versions/nokogiri.version | |
RUN grep "^ sassc " /gem_versions/Gemfile.lock | awk -F '[()]' '{print $2}' > /gem_versions/sassc.version |
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
### Keybase proof | |
I hereby claim: | |
* I am jacobat on github. | |
* I am jacobatz (https://keybase.io/jacobatz) on keybase. | |
* I have a public key ASCXkgitadJqqAAfP8ZVs_g0deD4gxDnw03ggDjKquZclQo | |
To claim this, I am signing this object: |
With the new multiple database support in Rails 6 connecting to more than one database from Rails becomes easier. There is a small gotcha to be aware of though. Take the following configuration:
development:
primary:
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host: <%= ENV["PG_HOST"] || "/tmp" %>
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
def a(name:, email:) | |
... | |
end | |
def b(email:, phone:) | |
... | |
end | |
def f(name:, email:, phone:) | |
a(...) |
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
def group_continuous(io) | |
result = [] | |
range_start = nil | |
offset = 0 | |
io.each_line do |line| | |
id = line.to_i | |
puts "#{id}\t#{range_start}\t#{offset}" | |
if !range_start.nil? && id == range_start + offset + 1 | |
offset = offset + 1 |
NewerOlder