Skip to content

Instantly share code, notes, and snippets.

@slbug
slbug / block-tor.sh
Created May 6, 2019 20:41 — forked from maxp/block-tor.sh
iptables Tor filter
ipset -N tor iphash
wget -q https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=$MY_IP -O - | sed '/^#/d' |while read IP
do
ipset -q -A tor $IP
done
iptables -A INPUT -m set --match-set tor src -j DROP
@slbug
slbug / Gemfile
Created February 25, 2016 14:50
Deadlock using sidekiq & fog
ruby '2.3.0'
source 'http://rubygems.org'
gem 'sidekiq'
gem 'fog'
gem 'mime-types'
# Code before:
resources :messages do
resources :comments
end
resources :posts do
resources :comments
resources :images, only: :index
end
require 'date'
require 'time'
require 'active_support/all'
p_inf = 1.0 / 0.0
n_inf = -1.0 / 0.0
class Date
def <=> (other)
conversion = :"to_#{self.class.name.downcase}"
require 'date'
require 'time'
require 'active_support/all'
p_inf = 1.0 / 0.0
n_inf = -1.0 / 0.0
module InfiniteComparable
extend ActiveSupport::Concern
Using the default profile...
Feature: Mount an Uploader on ActiveRecord class
In order to easily attach files to a form
As a web developer using CarrierWave
I want to mount an uploader on an ActiveRecord class
Background:
Given an uploader class that uses the 'file' storage
And an activerecord class that uses the 'users' table
And the uploader class is mounted on the 'avatar' column
~/.rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec --color ./spec/sanitized_file_spec.rb ./spec/mount_spec.rb ./spec/storage/fog_spec.rb ./spec/storage/cloudfiles_spec.rb ./spec/storage/s3_spec.rb ./spec/orm/activerecord_spec.rb ./spec/uploader/proxy_spec.rb ./spec/uploader/processing_spec.rb ./spec/uploader/default_url_spec.rb ./spec/uploader/extension_whitelist_spec.rb ./spec/uploader/cache_spec.rb ./spec/uploader/paths_spec.rb ./spec/uploader/remove_spec.rb ./spec/uploader/callback_spec.rb ./spec/uploader/configuration_spec.rb ./spec/uploader/url_spec.rb ./spec/uploader/download_spec.rb ./spec/uploader/mountable_spec.rb ./spec/uploader/store_spec.rb ./spec/uploader/versions_spec.rb ./spec/processing/rmagick_spec.rb ./spec/processing/mini_magick_spec.rb ./spec/processing/mime_types_spec.rb ./spec/compatibility/paperclip_spec.rb
DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from extend at ~/work/.forks/carri
Group Load (2.6ms) SELECT DISTINCT ON("groups"."id") "groups".* FROM "groups" INNER JOIN "attributes" ON "attributes"."group_id" = "groups"."id" INNER JOIN "specifications" ON "specifications"."attribute_id" = "attributes"."id" INNER JOIN "products" ON "products"."id" = "specifications"."product_id" WHERE "products"."id" = 16958
Attribute Load (5.7ms) SELECT "attributes".* FROM "attributes" WHERE "attributes"."group_id" IN (2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221)
Specification Load (6510.0ms) SELECT "specifications".* FROM "specifications" WHERE "specifications"."attribute_id" IN (41311, 41312, 41313, 41314, 41315, 41316, 41317, 41318, 41331, 41332, 41333, 41414, 41415, 41416, 41417, 41418, 41419, 41420, 41421, 41422, 41423, 41457, 41458, 41459, 41460, 41462, 41463, 41513, 41514, 41599, 41600, 41604, 41605, 41608, 41654, 41655, 41656, 41692, 41693, 41694, 41695, 41719, 41720, 41798, 41799, 41802, 41803, 41814, 41815, 41816, 41817, 41819, 4
diff --git a/lib/carrierwave/uploader/processing.rb b/lib/carrierwave/uploader/processing.rb
index 7c37d5b..73994cd 100644
--- a/lib/carrierwave/uploader/processing.rb
+++ b/lib/carrierwave/uploader/processing.rb
@@ -8,7 +8,7 @@ module CarrierWave
include CarrierWave::Uploader::Callbacks
included do
- class_inheritable_accessor :processors, :instance_reader => false, :instance_writer => false
+ class_attribute :processors, :instance_writer => false
Failures:
1) CarrierWave::Uploader.version with nested versions should process nested versions
Failure/Error: @uploader.rotated.should have_dimensions(337, 233)
expected "./spec/public/uploads/tmp/20110603-1559-456-4973/rotated_portrait.jpg" to have an exact size of 337 by 233, but it was 233 by 337.
# ./spec/uploader/versions_spec.rb:142:in `block (4 levels) in <top (required)>'
2) CarrierWave::Mount.mount_uploader expected behavior with subclassed uploaders should inherit defined processors properly
Failure/Error: @uploader1.processors.should == [[:rotate, [], nil]]
expected: [[:rotate, [], nil]]