class MyEventHandler
include BackgroundEventHandler
def call(event)
end
end
class MyOtherEventHandler
include ForegroundEventHandler
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 'sidekiq' | |
require 'active_job' | |
ActiveJob::Base.queue_adapter = :sidekiq | |
class Foo < ActiveJob::Base | |
queue_as :default | |
def perform | |
sleep 10 |
require 'dry-validation'
require 'dry-struct'
require 'active_model/errors'
require_relative '../create_study'
module MyApp
module Types
include Dry::Types.module
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 NullObject < BasicObject | |
def initialize(represents = nil) | |
@represents = represents || 'NullObject' | |
end | |
def nil?; true; end | |
def present?; false; end | |
def blank?; true; end | |
def empty?; true; end | |
def !; 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
Add = ->(add, n) { n + add } | |
Times = ->(times, n) { n * times } | |
AddOne = Add.curry.call(1) | |
TimesFour = Times.curry.call(4) | |
AddOneTimesFour = AddOne >> TimesFour | |
AddOneTimesFour.(2) # => 12 |
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 "bundler/inline" | |
gemfile(false) do | |
source "https://rubygems.org" | |
gem "rspec" | |
gem "pry-byebug" | |
end | |
require 'rspec/autorun' |
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 "bundler/inline" | |
gemfile(false) do | |
source "https://rubygems.org" | |
gem "dry-struct", '0.5' | |
gem "dry-types", '0.14' | |
gem 'rails_event_store-rspec', '1.0.0' | |
gem "pry-byebug" | |
gem 'activesupport' | |
end |
- 10:30 BG 4.5 mmol/litre
- Run:
- 6k
- 5:11 mins/km pace
- Elevation gain: 76m
- Max elevation: 107m
- 11:10 BG 6.2 mmol.litre
- Food (carbs)
- 11:50 BG 5.5 mmol/litre
- 12:30 BG 6.3 mmol/litre
ruby basic.rb
ruby aggregate_root.rb