Skip to content

Instantly share code, notes, and snippets.

View victormartins's full-sized avatar
💭
:shipit: Connecting the dots

Victor Martins victormartins

💭
:shipit: Connecting the dots
View GitHub Profile
# 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)
@victormartins
victormartins / coding_ideas.md
Last active December 1, 2017 07:44
Coding Ideas

Coding Topics

# 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.
@victormartins
victormartins / keybase.md
Created August 19, 2015 09:53
keybase.md

Keybase proof

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:

function github {
branch="$(git rev-parse --abbrev-ref HEAD)"
url="$(git config --get remote.upstream.url)"
url=${url/git@github.com:/http://github.com/}
url=${url/.git/}
if [[ $1 =~ "compare" ]]; then action="compare"
elif [[ $1 =~ "pr" ]]; then action="pull"
else action="tree"; fi
# How Clearance / Hoptoad does it
module Clearance
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Configuration.new
yield(configuration)
end
@victormartins
victormartins / capybara cheat sheet
Created December 11, 2011 10:17 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
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')