Skip to content

Instantly share code, notes, and snippets.

@printercu
printercu / vue-turbolinks-adapter.coffee
Last active October 13, 2020 21:38
Turbolinks adapter for vue
@printercu
printercu / policy.rb
Last active March 5, 2018 11:43
Policy like in cancan, but with class-level declarations
# Simple policy implementation. Like a mixin of Pundit and CanCan.
module Policy
ACTIONS_MAP = {
index: :read,
show: :read,
new: :create,
edit: :update,
}.freeze
class Error < StandardError; end
class RedisStats
attr_reader :redis, :pattern
def initialize(redis, pattern = '*')
@redis = redis
@pattern = pattern
end
def all_keys
@all_keys ||= [].tap do |result|