Skip to content

Instantly share code, notes, and snippets.


Vladimir Dementyev palkan

Block or report user

Report or block palkan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
palkan / many_vs_flat_map_bench.rb
Last active Dec 4, 2019
many vs flat_map bench
View many_vs_flat_map_bench.rb
# See:
# -
# - Rails PR:
require "benchmark_driver"
Benchmark.driver do |x|
x.prelude %Q{
Blog =
Category =
palkan /
Last active Dec 6, 2019
Backport Rails 6 per-environment credentials

Backport Rails 6 per-environment credentials to Rails 5.2

Rails PR:

This patch makes it possible to use per-environment credentials (i.e., config/credentials/staging.yml.enc) in Rails 5.2.


  • Drop backport_rails_six_credentials.rb and backport_rails_six_credentials_command.rb somewhere, for example, into the lib/ folder
  • Add this line to config/application.rb:

Keybase proof

I hereby claim:

  • I am palkan on github.
  • I am palkan ( on keybase.
  • I have a public key ASBivWpram8T0sSjr4zNGnRCfvj2TElWUqKfGEqvugkRIwo

To claim this, I am signing this object:

palkan /
Last active Aug 29, 2019
Railsy Rails Events Store

Railsy Rails Events Store

Since our architecture is modularized, we need a way for our components/engines to communicate with each other.

We do this by adding a pub/sub (or event sourcing) layer to our application via Rails Event Store.

We do not use RES directly but through the railsy-events engine, which wraps RES functionality and provide its own API. That would allow us to replace RES in the future (if necessary) without changing our application code.

Describe events

palkan / config.yml
Last active Mar 3, 2019
Parcel + GH pages + S3
View config.yml
version: 2.1
version: 2
- checkout
- yarn_install:
- checkout
palkan / patch.rb
Created Feb 28, 2019
rspec-rails vs. Rails 6.0.0.beta2
View patch.rb
# frozen_string_literal: true
# PR:
RSpec::Rails::ViewRendering::EmptyTemplateHandler.singleton_class.prepend( do
def call(template, _source)
View slim_faker.rb
# frozen_string_literal: true
# Faker load tons of useless locales by default
# (see
# And it's impossible to configure it(
# (see
# First, ensure i18n is loaded
palkan /
Last active Nov 21, 2018
AnyCable 0.6.0 releases
palkan /
Created Aug 17, 2018
[draft] Pundit to Action Policy

From Pundit to ActionPolicy:

  • Remove include Pundit from ApplicationController
  • Add alias authorize authorize!
  • Add authorize :current_user, as: :user
  • Add include ActionPolicy::Policy::Core to ApplicationPolicy
  • Update ApplicationPolicy#initialize:
def initialize(target, user:)
palkan / action_policy__i18n.rb
Last active Nov 2, 2018
ActionPolicy i18n basics
View action_policy__i18n.rb
# See issue:
module ActionPolicy
module I18n
class << self
def full_message(policy_class, rule)
# generate candidates
candidates = [:"#{policy_class.identifier}.#{rule}"]
# add global fallbacks
You can’t perform that action at this time.