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
Scenario: Get List of My Hitchhiking Items via API | |
Given the existing things: | |
|name| | |
|The Guide (duh)| | |
|A towel| | |
|Sub-Etha Sens-O-Matic| | |
|Pan Galactic Gargle Blaster| | |
|Kill-o-Zap blaster pistol| | |
And the existing accounts: | |
|email|name|password| |
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_relative "./interactor" | |
ctx = SomeInteractor::Context.new(var_a: true) | |
res = SomeInteractor.new(ctx).call | |
assert res.success? | |
res = SomeInteractor.new(var_a: false).call | |
assert res.failure? |
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 | |
require "delivery_boy" | |
class EventPublisher | |
KAFKA_TOPIC_PREFIX = ENV.fetch("KAFKA_TOPIC_PREFIX") | |
THREAD_LOCAL_KEY = :event_publisher_transaction_queue | |
DEFAULT_EVENT_DELIVERER = "ThreadLocalBackedDeliverer".freeze | |
delegate :add_event, :transaction_opened!, :transaction_committed!, :transaction_rolled_back!, to: :deliverer |
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 UserSearchService | |
def initialize(search_term, limit = nil, offset = nil) | |
@search_term = if search_term.is_a?(String) | |
search_term.split(" ") | |
else | |
search_term.values.reject(&:blank?) | |
end | |
@limit = limit | |
@offset = offset | |
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
#!/bin/sh | |
brew bundle --file=- <<EOF | |
tap "homebrew/cask" | |
brew "mas" | |
mas "Xcode", id: 497799835 | |
brew "ruby-install" |
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.7" | |
networks: | |
default: | |
driver: bridge | |
x-base: &base | |
networks: | |
- default |
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
config.use_transactional_fixtures = false | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:each) do | |
DatabaseCleaner.strategy = :transaction | |
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
require "securerandom" | |
require "benchmark" | |
require "google_hash" | |
require "memory_profiler" | |
require "pry" | |
class Item | |
def initialize | |
@keep = ([0, 1].sample == 1) | |
@key = SecureRandom.uuid |
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
Rehearsal ------------------------------------------------------- | |
{}.tap 0.000382 0.000257 0.000639 ( 0.000871) | |
[[]].to_h 0.000031 0.000001 0.000032 ( 0.000032) | |
{}.each_with_object 0.000027 0.000001 0.000028 ( 0.000028) | |
---------------------------------------------- total: 0.000699sec | |
user system total real | |
{}.tap 0.000030 0.000001 0.000031 ( 0.000029) | |
[[]].to_h 0.000033 0.000011 0.000044 ( 0.000033) | |
{}.each_with_object 0.000023 0.000012 0.000035 ( 0.000032) |
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 "benchmark" | |
require "benchmark/ips" | |
thing = :baz | |
puts "2 conditions, neither is true" | |
Benchmark.ips do |x| | |
x.report("conditional") do | |
if thing == :foo || thing == :bar | |
true |
NewerOlder