This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openssl' | |
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openssl' | |
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Ruby LoCo Hack Night Challenge #1 | |
require 'benchmark' | |
a = [1, 2, 3, 4, 5] | |
b = [2, 5, 1, 3, 4] | |
# write a program to match indexes from a to b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1..100).each do |n| | |
n = 'fizzbuzz' if n % 15 == 0 | |
n = 'fizz' if n % 3 == 0 | |
n = 'buzz' if n % 5 == 0 | |
puts n | |
end | |
------------- | |
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateSpreeTaxCloudTransactions < ActiveRecord::Migration | |
def change | |
create_table :spree_tax_cloud_transactions do |t| | |
t.references :order | |
t.string :message | |
t.timestamps | |
end | |
add_index :spree_tax_cloud_transactions, :order_id | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<DeliveryConfirmations xmlns:pchBase="http://schema.pchintl.com/pchBase_v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Action="Read" xsi:noNamespaceSchemaLocation="SC_1.0.xsd"> | |
<SC> | |
<SRef> | |
<RefV>B2C</RefV> | |
<RefQ>OrderType</RefQ> | |
</SRef> | |
<DN>50aa899205ffbb257e00000f_H438105531460</DN> | |
<AWB>UPSSAVER006</AWB> | |
<Car>UPSG-SAVER</Car> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::ShippingCategory Load (0.4ms) SELECT `spree_shipping_categories`.* FROM `spree_shipping_categories` WHERE `spree_shipping_categories`.`id` = 727197603 LIMIT 1 | |
Spree::ItemRate Load (4.4ms) SELECT `spree_item_rates`.* FROM `spree_item_rates` WHERE `spree_item_rates`.`rateable_id` = 727197603 AND `spree_item_rates`.`rateable_type` = 'Spree::ShippingCategory' | |
Spree::Zone Load (0.4ms) SELECT `spree_zones`.* FROM `spree_zones` WHERE `spree_zones`.`id` = 9 LIMIT 1 | |
Spree::Country Load (0.5ms) SELECT `spree_countries`.* FROM `spree_countries` WHERE `spree_countries`.`id` = 214 LIMIT 1 | |
Spree::Country Load (0.4ms) SELECT `spree_countries`.* FROM `spree_countries` WHERE `spree_countries`.`id` = 35 LIMIT 1 | |
Spree::Country Load (0.4ms) SELECT `spree_countries`.* FROM `spree_countries` WHERE `spree_countries`.`id` = 13 LIMIT 1 | |
Spree::Country Load (0.4ms) SELECT `spree_countries`.* FROM `spree_countries` WHERE `spree_countries`.`id` = 20 LIMIT 1 | |
Spree::Country Load (0.5ms) SELECT `spree_countrie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# store_works Apartment Switching | |
if defined? Rails | |
if defined? Apartment::Database | |
def switch(store) | |
Apartment::Database.switch(store) | |
ENV['INTERNAL_SUBDOMAIN'] = store | |
puts "=> Switching to #{store}" | |
end | |
class << self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Rails.env.development? | |
Rails.application.assets.logger = Logger.new('/dev/null') | |
Rails::Rack::Logger.class_eval do | |
def call_with_quiet_assets(env) | |
previous_level = Rails.logger.level | |
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/} | |
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/spraycan/} | |
call_without_quiet_assets(env) | |
ensure | |
Rails.logger.level = previous_level |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show | |
Rails.logger.debug('*' * 100) | |
Rails.logger.debug(self.view_paths.inspect) | |
Rails.logger.debug('*' * 100) | |
Rails.logger.debug(ApplicationController.view_paths.inspect) | |
Rails.logger.debug('*' * 100) | |
@product = find_product(params[:id]) | |
end | |