Skip to content

Instantly share code, notes, and snippets.

View jumph4x's full-sized avatar

Denis Ivanov jumph4x

  • FCP Euro
  • Oakland
View GitHub Profile
denis@s7-391 ~$ gem install spree
ERROR: While executing gem ... (Gem::ImpossibleDependenciesError)
rails-4.0.0 requires railties (= 4.0.0) but it conflicted:
Activated railties-4.0.0 instead of (~> 3.2.0) via:
sass-rails-3.2.6, select2-rails-3.4.9, spree_backend-2.1.2, spree-2.1.2
@jumph4x
jumph4x / ouch.css
Last active December 17, 2015 09:49
a.icon-listen-bl:hover, .event-related .box-title a:hover, .category-related .box-title a:hover, .readmore a:hover, .footer a:hover, .pagination a:hover, .news a:hover, .latest-tweet .date a:hover, .feature .box-header .title a:hover, .caption .title a:hover, .full-agenda-link a:hover, .article a:hover, .medialib-nav a:hover, .timeline-months a:hover, .Timeline .feature .box-footer a:hover, a.icon-listen-bl:active, .event-related .box-title a:active, .category-related .box-title a:active, .readmore a:active, .footer a:active, .pagination a:active, .news a:active, .latest-tweet .date a:active, .feature .box-header .title a:active, .caption .title a:active, .full-agenda-link a:active, .article a:active, .medialib-nav a:active, .timeline-months a:active, .Timeline .feature .box-footer a:active, a.icon-listen-bl:focus, .event-related .box-title a:focus, .category-related .box-title a:focus, .readmore a:focus, .footer a:focus, .pagination a:focus, .news a:focus, .latest-tweet .date a:focus, .feature .box-header .t
@jumph4x
jumph4x / -
Created May 10, 2013 08:39
After CloudFront integration
Testing http://www.fcpeuro.com/BMW-parts
At Fri May 10 01:35:52 2013
10 loops
Fastest Median Slowest Std Dev
---------------------------------------------------------------------------
Server performance:
Total application time 195ms 216ms 689ms 157ms
@jumph4x
jumph4x / -
Created May 9, 2013 07:39
Without Jirafe
Testing http://www.fcpeuro.com/BMW-parts
At Thu May 9 00:36:03 2013
10 loops
Fastest Median Slowest Std Dev
---------------------------------------------------------------------------
Server performance:
Total application time 193ms 196ms 205ms 3ms
@jumph4x
jumph4x / -
Created May 9, 2013 07:13
Without NewRelic RUM
Testing http://www.fcpeuro.com/BMW-parts
At Thu May 9 00:09:59 2013
10 loops
Fastest Median Slowest Std Dev
---------------------------------------------------------------------------
Server performance:
Total application time 194ms 213ms 440ms 85ms
@jumph4x
jumph4x / -
Created May 9, 2013 07:03
Loading all JS
Testing http://www.fcpeuro.com/BMW-parts
At Thu May 9 00:00:28 2013
10 loops
Fastest Median Slowest Std Dev
---------------------------------------------------------------------------
Server performance:
Total application time 198ms 210ms 297ms 27ms
@jumph4x
jumph4x / downcase_user_keys.rb
Created November 30, 2012 04:47
Retroactive fix for Spree #2263
class DowncaseUserKeys < ActiveRecord::Migration
def up
Spree::User.find_each do |user|
user.update_attributes :email => user.email.downcase
end
end
def down
end
end
@jumph4x
jumph4x / acts_as_solr_reloaded_ext.rb
Created August 31, 2012 20:58
Undoing hardcoded acts_as_solr_reloaded Dismax Request type
Solr::Request::Dismax.class_eval do
def to_hash
hash = super
#hash[:defType] = 'edismax' # Kill this little hardcoded gem in acts_as_solr_reloaded
hash[:tie] = @params[:tie_breaker]
hash[:mm] = @params[:minimum_match]
hash[:qf] = @params[:query_fields]
hash[:pf] = @params[:phrase_fields]
hash[:ps] = @params[:phrase_slop]
@jumph4x
jumph4x / gist:3442159
Created August 23, 2012 21:35
Subset Check
def is_subset?(a,b)
return true if b and b.is_a? Array and b.empty? # O(1)
hash = {} # O(1)
a.each{|v| hash[v] = true} # O(n) outer, O(1) inner, O(n) total
b.map{|v| hash[v] }.uniq == [true] # O(n) outer, O(1) inner, O(n) total
end
@jumph4x
jumph4x / shipment_decorator.rb
Created May 9, 2012 18:01
Destination Charges
Spree::Shipment.class_eval do
after_save :ensure_destination_charge
def ensure_correct_adjustment
if order.destination_charges[0]
# recalculate
else
order.destination_charges << create a new one
end
end