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
palkan / 01_Readme.md
Last active Sep 17, 2019
Backport Rails 6 per-environment credentials
View 01_Readme.md

Backport Rails 6 per-environment credentials to Rails 5.2

Rails PR: https://github.com/rails/rails/pull/33521

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

Installation

  • 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:
View keybase.md

Keybase proof

I hereby claim:

  • I am palkan on github.
  • I am palkan (https://keybase.io/palkan) on keybase.
  • I have a public key ASBivWpram8T0sSjr4zNGnRCfvj2TElWUqKfGEqvugkRIwo

To claim this, I am signing this object:

@palkan
palkan / 1_README.md
Last active Aug 29, 2019
Railsy Rails Events Store
View 1_README.md

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
palkan / config.yml
Last active Mar 3, 2019
Parcel + GH pages + S3
View config.yml
version: 2.1
workflows:
version: 2
build_and_test:
jobs:
- checkout
- yarn_install:
requires:
- checkout
@palkan
palkan / patch.rb
Created Feb 28, 2019
rspec-rails vs. Rails 6.0.0.beta2
View patch.rb
# frozen_string_literal: true
# PR: https://github.com/rspec/rspec-rails/pull/2095
RSpec::Rails::ViewRendering::EmptyTemplateHandler.singleton_class.prepend(Module.new do
def call(template, _source)
super(template)
end
end)
View slim_faker.rb
# frozen_string_literal: true
# Faker load tons of useless locales by default
# (see https://github.com/stympy/faker/tree/master/lib/locales)
#
# And it's impossible to configure it(
# (see https://github.com/stympy/faker/blob/v1.9.3/lib/faker.rb#L14-L15)
#
# First, ensure i18n is loaded
@palkan
palkan / anycable_0.6.0.md
Last active Nov 21, 2018
AnyCable 0.6.0 releases
View anycable_0.6.0.md
@palkan
palkan / doc.md
Created Aug 17, 2018
[draft] Pundit to Action Policy
View doc.md

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
palkan / action_policy__i18n.rb
Last active Nov 2, 2018
ActionPolicy i18n basics
View action_policy__i18n.rb
# See issue: https://github.com/palkan/action_policy/issues/15
module ActionPolicy
module I18n
class << self
def full_message(policy_class, rule)
# generate candidates
candidates = [:"#{policy_class.identifier}.#{rule}"]
# add global fallbacks
View 01_rack_rewrite_config.rb
class RackRewriteConfig
class << self
# Configure named rewrite rule
def configure(name, &block)
raise ArgumentError, "Block is required" unless block_given?
rules[name] = block
end
# Apply named rule to the target
def apply(target, name, *args)
You can’t perform that action at this time.