Skip to content

Instantly share code, notes, and snippets.

View briu's full-sized avatar

Igor Biryukov briu

View GitHub Profile
[{"tour_data"=>
{"operator_name"=>"ICS Travel", "nights"=>10, "meal_name"=>"RO(NO)", "room_name"=>"Стандартный номер\t (Standard Room)", "hotel_id"=>9069590, "price"=>108387, "exact_price"=>108387, "fuel_price"=>4650},
"flight_data"=>
{"flight_to"=>
[{"airline"=>"Vietnam Airlines", "flight"=>"VN 64", "airport_from"=>"DME", "airport_to"=>"HAN", "start_time"=>"18:10", "end_time"=>"07:15", "date"=>"18:10", "city_from"=>"Москва", "city_to"=>"Ханой"},
{"airline"=>"Vietnam Airlines", "flight"=>"VN 64", "airport_from"=>"HAN", "airport_to"=>"CXR", "start_time"=>"10:45", "end_time"=>"12:35", "date"=>"07:15", "city_from"=>"Ханой", "city_to"=>"Нячанг"}],
"flight_back"=>
[{"airline"=>"Vietnam Airlines", "flight"=>"VN 65", "airport_from"=>"CXR", "airport_to"=>"HAN", "start_time"=>"06:25", "end_time"=>"08:10", "date"=>"06:25", "city_from"=>"Нячанг", "city_to"=>"Ханой"},
{"airline"=>"Vietnam Airlines", "flight"=>"VN 65", "airport_from"=>"HAN", "airport_to"=>"DME", "start_time"=>"10:10", "en
{
tour_data: {price:"68278", exact_price: "68278"},
flight_data:
[
{"airline"=>"Nordwind Airlines", "flight"=>"N4148", "airport_from"=>"1", "airport_to"=>"D", "start_time"=>"20:50", "end_time"=>"22:00", "date"=>"13.12.2016", "class"=>"ECONOM"},
{"airline"=>"Nordwind Airlines", "flight"=>"N4147", "airport_from"=>"D", "airport_to"=>"1", "start_time"=>"18:20", "end_time"=>"19:45", "date"=>"21.12.2016", "class"=>"ECONOM"},
{"airline"=>"Северный Ветер", "flight"=>"N41801", "airport_from"=>"C", "airport_to"=>"1", "start_time"=>"08:00", "end_time"=>"10:30", "date"=>"14.12.2016", "class"=>"ECONOM"},
{"airline"=>"Северный Ветер", "flight"=>"N41802", "airport_from"=>"1", "airport_to"=>"C", "start_time"=>"11:00", "end_time"=>"16:15", "date"=>"21.12.2016", "class"=>"ECONOM"}
]
}
str = "aaa"
str + "b"
puts str
str << "c"
puts str
class CallCenter < ActiveRecord::Base
def self.prepare_to_work
all.each do |call_center|
method_name = "prepare_to_work_name_#{call_center.name}"
call_center.send(method_name) if call_center.respond_to?(method_name)
end
end
def prepare_to_work_name_test1
@briu
briu / memo.rb
Last active August 29, 2016 09:32
interview
class Order < ActiveRecord::Base
end
class OrderReport
attr_reader :date
def initialize(date)
@date = date
end
class A
private
def some_method
puts 'HOLA!'
end
end
class B < A
def test_some_method_exec
CREATE TABLE orders (
id integer,
name varchar(255),
address varchar(255)
);
CREATE TABLE order_items (
id integer,
price integer,
order_id integer,
@briu
briu / customers.sql
Created August 26, 2016 15:23
interview
CREATE TABLE customers (
source_id integer,
name varchar(255)
);
INSERT INTO customers (source_id, name) values (null, 't1'), (1, 't2'), (2, 't3'), (3, 't5'), (null, 't5');
SELECT COUNT(*) FROM customers WHERE source_id <> 3;
@briu
briu / modules.rb
Last active August 26, 2016 14:32
interview
module AddMePlease
def some_useful_method
2 + 2
end
def second_useful_method
2 * 3
end
end
class Client
attr_reader :item
def initialize(item)
@item = item
end
def calculate_something
80 * 20
end