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 Person | |
attr_reader :first_name, :last_name | |
def initialize(first_name, last_name) | |
@first_name, @last_name = first_name, last_name | |
end | |
end | |
class PersonWithFullName < SimpleDelegator | |
def full_name |
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
# frozen_string_literal: true | |
class ChangePackage | |
include Failable | |
attr_reader :subscription, :package, :expire_date, :package_history | |
private *delegate :store_campagin!, :upcoming_package_change? | |
:current_invoice, to: :subscription | |
def initialize(subscription, package) |
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
module Failable | |
class Result < SimpleDelegator | |
def initialize(success, object = nil) | |
@success = success | |
super(object) | |
end | |
def success? | |
@success | |
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
# Maintainer: Knut Ahlers <knut at ahlers dot me> | |
# Contributor: Det <nimetonmaili g-mail> | |
# Contributors: t3ddy, Lex Rivera aka x-demon, ruario | |
# Check for new Linux releases in: http://googlechromereleases.blogspot.com/search/label/Stable%20updates | |
# or use: $ curl -s https://dl.google.com/linux/chrome/rpm/stable/x86_64/repodata/other.xml.gz | gzip -df | awk -F\" '/pkgid/{ sub(".*-","",$4); print $4": "$10 }' | |
pkgname=google-chrome | |
pkgver=73.0.3770.80 | |
pkgrel=1 |
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
function! RenameFile() | |
let old_name = expand('%') | |
let new_name = input('New file name: ', expand('%'), 'file') | |
if new_name != '' && new_name != old_name | |
exec ':saveas ' . new_name | |
exec ':silent !rm ' . old_name | |
redraw! | |
endif | |
endfunction |
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 Television < ActiveModel | |
def turned_off? | |
!turned_on | |
end | |
end | |
class TelevisionRemote | |
attr_reader :television | |
def initialize(television) |
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 DropSubscriptionRewards < ActiveRecord::Migration[5.2] | |
def up | |
subscription_rewards = ActiveRecord::Base.connection.select_all("select * from subscription_rewards") | |
subscription_rewards.each do |subscription_reward| | |
MissionReward.create!( | |
subscription_mission_id: subscription_reward["subscription_mission_id"], | |
reward_id: subscription_reward["reward_id"], | |
starts_at: subscription_reward["created_at"], | |
ends_at: subscription_reward["expires_at"], | |
redeemed_at: subscription_reward["redeemed_at"] |
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 DropSubscriptionRewards < ActiveRecord::Migration[5.2] | |
def up | |
subscription_rewards = ActiveRecord::Base.connection.select_all("select * from subscription_rewards") | |
subscription_rewards.each do |subscription_reward| | |
MissionReward.create!( | |
subscription_mission_id: subscription_reward["subscription_mission_id"], | |
reward_id: subscription_reward["reward_id"], | |
starts_at: subscription_reward["created_at"], | |
ends_at: subscription_reward["expires_at"], | |
redeemed_at: subscription_reward["redeemed_at"] |