🤹♂️
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
FROM ruby | |
WORKDIR /app | |
COPY Gemfile Gemfile.lock ./ | |
RUN bundle --deployment | |
RUN bundle show rack |
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
version: "3.6" | |
services: | |
app: | |
build: .. | |
depends_on: | |
- selenium | |
environment: | |
SELENIUM_HOST: selenium |
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
# Homebrew has $HOMEBREW_ARTIFACT_DOMAIN which allows using a mirror for downloads: | |
# | |
# https://docs.brew.sh/Manpage#environment | |
# | |
# But no easy way to create such a mirror. This command which creates a mirror from | |
# all core formulae downloads. Pop it in /usr/local/Homebrew/Library/Homebrew/cmd/ | |
# with a `chmod +x` and run `brew mirror-artifacts`. | |
require "formula" |
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 link_to(url, content = nil) | |
if ENV["BUILDKITE"] | |
"\e]1339;url=#{url.gsub(";", "%3b")}#{";content=#{content.gsub(";", "%3b")}" if content}\a" | |
else | |
url | |
end | |
end | |
def system!(*args) | |
system(*args) or fail("Command exited with status #{$?.exitstatus}: #{args.join(" ")}") |
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 link_to(url, content = nil) | |
if ENV["BUILDKITE"] | |
"\e]1339;url=#{url.gsub(";", "%3b")}#{";content=#{content.gsub(";", "%3b")}" if content}\a" | |
else | |
url | |
end | |
end | |
def system!(*args) | |
system(*args) or fail("Command exited with status #{$?.exitstatus}: #{args.join(" ")}") |
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
gem "railties", "5.2.0" | |
gem "actionmailer", "5.2.0" | |
require "rails/application" | |
require "action_mailer/railtie" | |
class Application < Rails::Application | |
config.eager_load = true | |
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
# Weak ACID semantics for Sidekiq jobs | |
# | |
# Include this module in a Sidekiq::Worker class and it will defer enqueuing | |
# jobs for that worker within an open ActiveRecord transaction until it is | |
# committed. Rollbacks will prevent any jobs being enqueued at all. | |
# | |
# ActiveRecord keeps track of all records which are being utilized within a | |
# transaction so it can fulfil commit and rollback callbacks. We create a fake | |
# record that quacks the same way for the same hooks. | |
# |
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
[Unit] | |
Description=Sidekiq workers | |
# start as many workers as you want here | |
Wants=sidekiq@1.service | |
Wants=sidekiq@2.service | |
# ... | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/true |
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
gem "activerecord", "~> 4.0.0" | |
require "active_record" | |
## Implementation | |
module ActiveRecord::OmitMethods | |
# Inverse of #merge, negates and merges the conditions from <tt>other</tt>, if <tt>other</tt> is an <tt>ActiveRecord::Relation</tt>. | |
# Returns an array representing the subset of the resulting records not appearing in <tt>other</tt>, if <tt>other</tt> is an array. | |
# Post.where(published: true).joins(:comments).omit( Comment.where(spam: false) ) |
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 "thread" | |
# Simple thread safe rate limiter | |
# | |
# Supply a limit of operations, and an interval in seconds (defaults to 1 | |
# second, so ops/sec). | |
# | |
# Call `#wait` on every operation which will return immediately or sleep until | |
# the rate limit is satified. | |
# |