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
Rails.application.configure do | |
# Add Cloudflare's IPs to the trusted proxy list so they are ignored when | |
# determining the true client IP. | |
# | |
# See https://www.cloudflare.com/ips-v4/ and https://www.cloudflare.com/ips-v6/ | |
config.action_dispatch.trusted_proxies = ActionDispatch::RemoteIp::TRUSTED_PROXIES + %w[ | |
173.245.48.0/20 | |
103.21.244.0/22 | |
103.22.200.0/22 | |
103.31.4.0/22 |
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
create table gifts_partitioned ( | |
id integer not null default nextval('gifts_id_seq'::regclass), | |
; ... | |
finished boolean not null default false, | |
; ... | |
PRIMARY KEY(id, finished) | |
) | |
partition by list(finished); |
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
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <stdio.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <sys/shm.h> |
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
ActiveRercord::Base.transaction do | |
user = User.create!(params) | |
user_profile = User::Profile.create!(user: user) | |
UserHandler.perform_async(user.id) | |
# 10 строк кода | |
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
# User attributes name surname | |
class User < ApplicationRecord | |
# attributes :id, integer | |
# attributes :name, string | |
# attributes :email, string | |
def log! | |
Log.create!(...) | |
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
ApplicationRecord.transaction do | |
user = User.create! | |
CalculatePayoutJob.perform_later(user) | |
// куча действий тут | |
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 MailParser | |
delegate :within_window, :within_frame, :find, :all, :window_opened_by, :page, :click_link, :first, to: :@capybara | |
def initialize(window, capybara) | |
@window = window | |
@capybara = capybara | |
@users_count = 0 | |
@current_idx = 0 | |
end |