Skip to content

Instantly share code, notes, and snippets.

View asvetly's full-sized avatar

Aleksandr Svetly asvetly

View GitHub Profile
@asvetly
asvetly / gist:90a9df4565a6556303f33355412918db
Created August 2, 2017 20:28
Установка pathogen.vim
#fish shell
mkdir -p ~/.vim/autoload ~/.vim/bundle;
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
@asvetly
asvetly / install_pathogen.sh
Created August 2, 2017 20:29
Установка pathogen.vim
#fish shell
mkdir -p ~/.vim/autoload ~/.vim/bundle;
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
@asvetly
asvetly / install_vim-ruby_plugin.sh
Created August 2, 2017 20:37
Installing vim-ruby plugin
git clone git://github.com/vim-ruby/vim-ruby.git ~/.vim/bundle/vim-ruby
#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
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")
class ReportSender
def initialize(report, account)
@report = report
@account = account
end
def send_report
Mailer.deliver(
from: 'foo@bar.com',
to: @account.email,
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(
class ReportSender
def initialize(report, account)
@report = report
@account = account
end
def send_report(sender = EmailSender.new)
sender.send(@account)
end
end
class Animal
def talk
''
end
end
class Dog < Animal
def talk
'bork'
end
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