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
bundle gem change_ledger --coc --mit --exe --test=rspec --ci=github --linter=standard |
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
# Prompt: | |
What’s your most elegant Ruby code that does this: | |
* takes an array of strings and a target string | |
* if the target string is not in the array, return the array | |
* if the target string is in the array, return the array with the target string moved from its position to the end of the array. | |
What’s your most elegant Ruby code that does this: | |
* takes an array of strings and a target string |
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
class Module | |
def sigilize(method_name) | |
define_method("#{method_name}?") do |*args, **kwargs| | |
!!method_name(*args, **kwargs) | |
end | |
define_method("#{method_name}!") do |*args, **kwargs| | |
result = method_name(*args, **kwargs) | |
raise StandardError unless result | |
result |
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
class Consumer | |
def takes_args(a, b, c) | |
p "#{a} #{b} #{c}" | |
end | |
def takes_keys(a:, b:, c:) | |
p "#{a} #{b} #{c}" | |
end | |
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
class Consumer | |
def takes_args(a, b, c) | |
p "#{a} #{b} #{c}" | |
end | |
def takes_keys(a:, b:, c:) | |
p "#{a} #{b} #{c}" | |
end | |
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
class TestClass | |
extend Quiz::TestCase | |
def with_a_user | |
@user = User.new | |
end | |
def with_an_admin | |
@user = User.new(admin: 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
# syntax=docker/dockerfile:1 | |
FROM ruby:3.1.2 | |
RUN apt-get update -qq && apt-get install -y sqlite3 | |
WORKDIR /myapp | |
COPY Gemfile /myapp/Gemfile | |
COPY Gemfile.lock /myapp/Gemfile.lock | |
RUN bundle install | |
# Add a script to be executed every time the container starts. | |
COPY entrypoint.sh /usr/bin/ |
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
Hi |
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
RSpec.configure do |config| | |
config.before(:each, type: :system) do | |
driven_by :rack_test | |
end | |
config.before(:each, type: :system, js: true) do | |
if ENV["SELENIUM_DRIVER_URL"].present? | |
driven_by :selenium, using: :chrome, | |
options: { | |
browser: :remote, |
NewerOlder