Skip to content

Instantly share code, notes, and snippets.

View palkan's full-sized avatar

Vladimir Dementyev palkan

View GitHub Profile
@palkan
palkan / keybase.md
Created July 4, 2017 13:04
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 ASD9_7Qr5xvMYx75u8VApLRsuCjYGR87WquHVLTtuUahwAo

To claim this, I am signing this object:

@palkan
palkan / 01_rack_rewrite_config.rb
Created November 7, 2017 09:19
RackRewriteConfig
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)
@palkan
palkan / action_policy__i18n.rb
Last active November 2, 2018 16:22
ActionPolicy i18n basics
# 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
@palkan
palkan / doc.md
Created August 17, 2018 22:22
[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
palkan / anycable_0.6.0.md
Last active November 21, 2018 23:00
AnyCable 0.6.0 releases
@palkan
palkan / slim_faker.rb
Created February 19, 2019 17:21
Slim Faker
# 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 / patch.rb
Created February 28, 2019 23:49
rspec-rails vs. Rails 6.0.0.beta2
# 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)
@palkan
palkan / config.yml
Last active March 3, 2019 18:28
Parcel + GH pages + S3
version: 2.1
workflows:
version: 2
build_and_test:
jobs:
- checkout
- yarn_install:
requires:
- checkout
@palkan
palkan / 1_README.md
Last active August 29, 2019 13:26
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
palkan / keybase.md
Created June 7, 2019 00:16
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: