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
#fish shell | |
mkdir -p ~/.vim/autoload ~/.vim/bundle; | |
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim |
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
#fish shell | |
mkdir -p ~/.vim/autoload ~/.vim/bundle; | |
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim |
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
git clone git://github.com/vim-ruby/vim-ruby.git ~/.vim/bundle/vim-ruby |
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
#fish shell | |
echo >> test.rb "\ | |
class User < ApplicationRecord | |
# Assign an API key on create | |
before_create do |user| | |
user.api_key = user.generate_api_key | |
end | |
# Generate a unique API key | |
def generate_api_key |
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 ReportSender | |
def initialize(data, account) | |
@data = data | |
@account = account | |
@report = '' | |
end | |
def generate_report! | |
@report = @data.map { |row| "User: #{row.user} action: #{row.action} date: #{row.created_at}" | |
}.join("\n") |
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 ReportSender | |
def initialize(report, account) | |
@report = report | |
@account = account | |
end | |
def send_report | |
Mailer.deliver( | |
from: '[email protected]', | |
to: @account.email, |
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 ReportSender | |
def initialize(report, account) | |
@report = report | |
@account = account | |
end | |
def send_report(way_of_sending = :email) | |
case way_of_sending | |
when :email | |
Mailer.deliver( |
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 ReportSender | |
def initialize(report, account) | |
@report = report | |
@account = account | |
end | |
def send_report(sender = EmailSender.new) | |
sender.send(@account) | |
end | |
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
class Animal | |
def talk | |
'' | |
end | |
end | |
class Dog < Animal | |
def talk | |
'bork' | |
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
class Dog < Animal | |
def talk | |
['bork', 'gav', 'rgrhrghrgr', 'woof'] | |
end | |
end | |
def animal_info(animal) | |
"This is #{animal.class.name} and it says #{animal.talk.upcase}" | |
end |
OlderNewer