Skip to content

Instantly share code, notes, and snippets.

View PavelPenkov's full-sized avatar

Pavel Penkov PavelPenkov

  • InSales
  • Moscow, Russia
View GitHub Profile
Name: sprockets
Version: 2.2.3.backport2
Advisory: CVE-2014-7819
Criticality: Medium
URL: https://groups.google.com/forum/#!topic/rubyonrails-security/doAVp0YaTqY
Title: Arbitrary file existence disclosure in Sprockets
Solution: upgrade to ~> 2.0.5, ~> 2.1.4, ~> 2.2.3, ~> 2.3.3, ~> 2.4.6, ~> 2.5.1, ~> 2.7.1, ~> 2.8.3, ~> 2.9.4, ~> 2.10.2, ~> 2.11.3, ~> 2.12.3, >= 3.0.0.beta.3
Name: actionpack
Version: 3.2.22
class None
def map(&block)
self
end
def flat_map(&block)
self
end
def value
@PavelPenkov
PavelPenkov / fsm.cs
Last active February 29, 2016 09:13 — forked from anonymous/fsm.cs
using System;
public interface FSM<S,E,T> {
public void defineTransition(S oldState, E event, S newState, Action<T> action);
public void consumeEvent(E event);
public S getState();
public void setState(S newState);
}
@filenames, @urls = *product.images.map { |i| [i.original_filename, i.image_original_url] }.transpose.map(&:to_set)
User = Struct.new(:email)
Post = Struct.new(:user, :text)
class PostRepresenter < Representable::Decorator
include Representable::JSON
property :text
property :user, populator: lambda { |input, options| options[:represented].user = User.new }
end
@PavelPenkov
PavelPenkov / repr.rb
Last active October 7, 2016 08:20 — forked from anonymous/repr.rb
module Settings
DISCRIMINATOR = :type
TYPE_TO_CLASS = Hash[Setting.subclasses.map { |klass| [klass.name.underscore, klass] }].freeze
class SettingRepresenter < Representable::Decorator
include ::Representable::JSON
property :name
property DISCRIMINATOR, skip_parse: true, getter: lambda {|options| options[:represented].class.name.underscore }