brew install emacs
&&
brew link emacs
git clone -b develop https://github.com/syl20bnr/spacemacs ~/.emacs.d
nvmrc=~/.nvm/nvm.sh | |
if [ -e $nvmrc ]; then | |
source $nvmrc | |
nvm use | |
fi | |
PATH_add node_modules/.bin |
# frozen_string_literal: true | |
# CLI tool, accepts user input; | |
# Saves as txt file | |
# archives that txt file | |
require 'pry' | |
require 'zip' | |
USER_INPUT_FILENAME = 'user_input.txt' |
### lib/user_input.rb | |
class UserInput | |
class InvalidUserInput < StandardError; end | |
def initialize(input) | |
@input = input | |
end | |
def to_s |
# homework.rb | |
class Homework | |
attr_reader :title, :content, :completed | |
def initialize(title:, content:) | |
@title = title | |
@content = content | |
@completed = false | |
end |
# ./spec/user_spec.rb | |
require_relative '../../lib/user.rb' | |
require 'ostruct' | |
RSpec.describe User do | |
subject { described_class.new(name: name, payment_service: payment_service) } | |
let(:name) { 'John Doe' } | |
let(:success_result) { true } |
# frozen_string_literal: true | |
### Usage | |
# Helps to understand how operation run affects the database state | |
# DatabaseChangesLogger.call(filename: 'output') { Operation.perform } | |
module DatabaseChangesLogger | |
EVENTS_TYPE = 'sql.active_record' | |
OPERATION_REGEX = /Update|Create/.freeze |
require 'rails_helper' | |
RSpec.describe User, type: :model do | |
subject { described_class.new(params) } | |
let(:params) do | |
{ | |
name: 'John' | |
} | |
end |
It might be overwhelming to dive into the Nix world, but this little glossary should help refine your understanding of the tools you might encounter when starting your journey.
UPD: I wrote one more short article to articulate why I prefer nix over non-nix setups in general: https://dev.to/alexander_shagov/why-use-nix-even-on-macos-786
Nix Package Manager – The core tool that allows declarative and reproducible package management.
NixOS – A Linux distribution built entirely on the Nix package manager. It's better to start with nix package manager alone before switching to NixOS completely.
In the Ruby on Rails community, service objects have gained popularity as a way to encapsulate business logic and keep controllers and models lean. However, there's a growing trend of misusing service objects, particularly those with "-er" or "-or" suffixes. This article aims to shed light on poorly implemented service objects and provide guidance on creating more effective, domain-focused alternatives.
Many developers tend to name their service objects with suffixes like -er
or -or
, such as ArticleCreator
or UserAuthenticator
. While this naming convention may seem intuitive, it often leads to a procedural style of programming rather than embracing the object-oriented nature of Ruby.
It's becoming evident that service objects the way we often see them are not actually "objects", but just a procedures.. or better to say, processess.