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
| require 'base64' | |
| require 'aes' | |
| class TextMessage | |
| attr_accessor :encryptor | |
| attr_reader :original_message | |
| def initialize(original_message, encryptor) | |
| @original_message = original_message | |
| @encryptor = encryptor |
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
| class Item | |
| attr_reader :title, :description, :price | |
| def initialize(arg = {}) | |
| @title = arg[:title] | |
| @description = arg[:description] | |
| @price = arg[:price] | |
| end | |
| end | |
| class AbstractReport |
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
| TrackingClick | |
| .preload(:trackingpostback, :device, :campaignaction, :customer, :campaign, :user, :account) | |
| .select(:utm_source, :utm_campaign, :utm_medium, :utm_term, 'device.platform', 'Count(tc.id)', 'Count(DISTINCT d.id)') | |
| .where(utm_source: :youtube) | |
| .where('device.createdat >= 2017-03-01 00:00:00') | |
| .group([1, 2, 3, 4, 5]) |
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
| require ‘bundler' | |
| require ’sinatra' | |
| Bundler.require | |
| # файл-ключик с доступами | |
| KEY_FILE = 'client_secret.json' | |
| # ссылка на таблицу в google drive | |
| FILE_URL = 'https://docs.google.com/spreadsheets/d/1-siWRqiCkMBixA-_________/edit' |
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
| <!-- Просто загрузка страницы --> | |
| <% if @status == :hello %> | |
| <form method="POST" action="/" style="max-width: 450px;"> | |
| <div class="form-group"> | |
| <label for="exampleInputFIO1">ФИО</label> | |
| <input type="text" class="form-control" name="name" id="exampleInputFIO1" placeholder="Иванов Иван Иванович"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="exampleInputEmail1">Email</label> | |
| <input type="email" class="form-control" name="email" id="exampleInputEmail1" placeholder="[email protected]"> |
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
| module Coffee | |
| class Espresso | |
| def initialize | |
| @ingredients = { | |
| espresso: true | |
| } | |
| end | |
| end | |
| class EspressoMacchiato |
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
| class CoffeeMaker | |
| def self.make_coffee(params) | |
| ingredients = { | |
| espresso: params.fetch(:espresso, false), | |
| milk_foam: params.fetch(:milk_foam, false), | |
| whipped_cream: params.fetch(:whipped_cream, false), | |
| steamed_milk: params.fetch(:steamed_milk, false), | |
| chokolate_syrup: params.fetch(:chokolate_syrup, false), | |
| hot_water: params.fetch(:hot_water, false) | |
| } |
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
| class GeoCoordinate | |
| # some code | |
| ## | |
| # returns array | |
| def three_nearest_coordinates | |
| return [] unless @latitude.present? and @longitude.present? | |
| coords_count = nearest_coordinates_count |
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
| class GeoCoordinate | |
| def initialize(latitude, longitude) | |
| @latitude = latitude | |
| @longitude = longitude | |
| end | |
| ## | |
| # returns array | |
| def nearest_coordinates |
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
| def GeoCoordinate(*args) | |
| case args.first | |
| when String | |
| GeoCoordinate.new(*args[0].to_i, *args[1].to_i) | |
| when Array | |
| GeoCoordinate.new(*args[0][0], *args[1][0]) | |
| when Hash | |
| GeoCoordinate.new(*args[0][:latitude], *args[0][:longitude]) | |
| when ->(arg) { %w(Float Fixnum).include?(arg.class.to_s) } | |
| GeoCoordinate.new(*args) |