View content_for_inside_cache.rb
# config/initializers/content_for_inside_cache.rb | |
module AbstractController | |
class Base | |
attr_internal :cached_content_for | |
end | |
module Caching | |
# actionpack/lib/action_controller/caching/fragments.rb | |
module Fragments |
View detailed_hash_diff.rb
require 'facets/hash/recurse' | |
# Usage: | |
# expect(actual).to match_hash(expected) | |
# | |
RSpec::Matchers.define :match_hash do |expected| | |
match do |actual| | |
# Sort hashes before comparing so that the diff only shows actual changes between keys and | |
# values. | |
actual = actual.recurse {|h| h.sort_by {|k,v| k.to_s }.to_h } |
View .gitignore
d3-force-labels.js |
View main.rb
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'rails', '5.1.4' |
View spree_export_import.rake
namespace :spree do | |
desc "Export Products to CSV File" | |
task :export_products => :environment do | |
require 'csv' | |
products = Product.where(:deleted_at => nil).all | |
puts "Exporting to #{RAILS_ROOT}/products.csv" | |
CSV.open("#{RAILS_ROOT}/products.csv", "w") do |csv| | |
csv << [ |