This file contains hidden or 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 'rom-repository' | |
| require 'rom-sql' | |
| require 'logger' | |
| config = ROM::Configuration.new(:sql, 'sqlite::memory') | |
| config.gateways[:default].connection.create_table(:songs) do | |
| primary_key :id | |
| column :title, String | |
| end |
This file contains hidden or 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 'logger' | |
| require 'byebug' | |
| require 'dry/monads' | |
| require 'dry/monads/do' | |
| require 'dry/matcher/result_matcher' | |
| module Dry | |
| module Transaction | |
| module Steps |
This file contains hidden or 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/ips' | |
| require 'active_model' | |
| require 'virtus' | |
| require 'dry-validation' | |
| require 'dry/validation/schema/form' | |
| class User | |
| include ActiveModel::Validations | |
| include Virtus.model |
This file contains hidden or 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 'dry/monitor/notifications' | |
| module MyApp | |
| def self.notifications | |
| @__notifications__ ||= Dry::Monitor::Notifications.new(:my_app) | |
| end | |
| notifications.register_event("users.created") | |
| class Logger |
This file contains hidden or 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 route_name | |
| Rails.application.routes.recognize(request) { |route, _| route.name }.flatten.last.name.to_sym | |
| end |
This file contains hidden or 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
| Calculating ------------------------------------- | |
| type-safe users 273.000 i/100ms | |
| ar user models 257.000 i/100ms | |
| ------------------------------------------------- | |
| type-safe users 2.813k (± 1.7%) i/s - 14.196k | |
| ar user models 2.574k (±10.7%) i/s - 12.850k | |
| Comparison: | |
| type-safe users: 2812.7 i/s | |
| ar user models: 2574.2 i/s - 1.09x slower |
This file contains hidden or 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
Show hidden characters
| { | |
| "name": "app", | |
| "dockerComposeFile": "docker-compose.yml", | |
| "service": "dev", | |
| "workspaceFolder": "/usr/local/src/app", | |
| "extensions": [ | |
| "eamodio.gitlens", | |
| "sleistner.vscode-fileutils", | |
| "rebornix.Ruby", | |
| "castwide.solargraph", |
This file contains hidden or 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 CreateStuff | |
| def initialize(stuff_repo) | |
| @stuff_repo = stuff_repo | |
| end | |
| def call(params) | |
| @stuff_repo.create(params) | |
| end | |
| end |
This file contains hidden or 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
| { | |
| // See https://go.microsoft.com/fwlink/?LinkId=733558 | |
| // for the documentation about the tasks.json format | |
| "version": "2.0.0", | |
| "options": { | |
| "shell": { | |
| "executable": "/usr/local/bin/zsh", | |
| "args": ["-l", "-c"] | |
| } | |
| }, |
This file contains hidden or 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 User | |
| include Virtus | |
| attribute :address do | |
| attribute :street, String | |
| attribute :city, String | |
| attribute :zipcode, String | |
| end | |
| end |
NewerOlder