Coding Topics
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
# Remove business logic from controller | |
class CreatePortFolioItem | |
Response = Struct.new(:saved?, :message) | |
def initialize(portfolio_repository: Portfolio) | |
@portfolio_repository = portfolio_repository | |
end | |
def call(request_params) |
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
# Source: https://www.destroyallsoftware.com/talks/boundaries | |
# @garybernhardt | |
# | |
# This talk is about using simple values (as opposed to complex objects) not just for holding data, | |
# but also as the boundaries between components and subsystems. | |
# It moves through many topics: functional programming; mutability's relationship to OO; | |
# isolated unit testing with and without test doubles; and concurrency, to name some bar. | |
# The "Functional Core, Imperative Shell" screencast mentioned at the end is available as part of | |
# season 4 of the DAS catalog. |
I hereby claim:
- I am victormartins on github.
- I am victor_martins (https://keybase.io/victor_martins) on keybase.
- I have a public key whose fingerprint is A49F A2AF 7077 F6C2 225A 1CB9 894B F080 47ED 6F6D
To claim this, I am signing this object:
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
function github { | |
branch="$(git rev-parse --abbrev-ref HEAD)" | |
url="$(git config --get remote.upstream.url)" | |
url=${url/[email protected]:/http://github.com/} | |
url=${url/.git/} | |
if [[ $1 =~ "compare" ]]; then action="compare" | |
elif [[ $1 =~ "pr" ]]; then action="pull" | |
else action="tree"; fi |
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
# How Clearance / Hoptoad does it | |
module Clearance | |
class << self | |
attr_accessor :configuration | |
end | |
def self.configure | |
self.configuration ||= Configuration.new | |
yield(configuration) | |
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
DOCS: http://rubydoc.info/github/jnicklas/capybara/master/file/README.rdoc | |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
current_path.should == post_comments_path(post) | |
=Clicking links and buttons= | |
click_link('id-or-text') | |
click_button('id-or-text') |