This file contains hidden or 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
{ | |
"order": { | |
"note": "This is a customer note made at checkout or similar that will be internally visiable to M&E personnel.", | |
"local_delivery_date": "2019/01/24", // must be in YYYY/MM/DD | |
"shipping_address": { | |
"address1": "123 Amoebobacterieae St", // required | |
"address2": "", | |
"city": "Ottawa", // required | |
"company": null, | |
"country": "Canada", // required |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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 country = Spree::Country.find_by(name: 'Canada') | |
tax_cat = Spree::TaxCategory.create!( | |
name: "Canadian Tax", | |
description: "Products sold in Canada", | |
is_default: true) | |
gst_opts = { | |
name: 'GST', | |
amount: 0.05, |
This file contains hidden or 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::OrderUpdater.class_eval do | |
module BetterPromotions | |
# DD: called by 'update_adjustment_total' before setting totals on order | |
def recalculate_adjustments | |
# DD: first, calculate all_adjustments for Order, LineItem, and Shipment using Spree::ItemAdjustments | |
super | |
# DD: FYI: promo_totals are negative |
This file contains hidden or 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
namespace :wombat do | |
desc "Push back Spree::Order push timestamp by 12 hours" | |
task reset_order_timestamp: :environment do | |
timestamps = Spree::Wombat::Config[:last_pushed_timestamps] | |
timestamps["Spree::Order"] = 12.hours.ago | |
Spree::Wombat::Config[:last_pushed_timestamps] = timestamps | |
end | |
end |
This file contains hidden or 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
# DD: pull the MySQL database down | |
# DD: base code: http://stackoverflow.com/questions/13638112/how-to-create-a-capistrano-task-to-download-latest-database-backup-tgz-and-impor | |
# DD: base code: https://gist.github.com/1726896 | |
require 'nokogiri' | |
require 'colored' | |
namespace :db do | |
desc 'Pull the DB from the server' | |
task :pull, :roles => :db, :only => { :primary => true } do | |
filename = "#{application}.dump.#{Time.now.to_f}.sql" |
This file contains hidden or 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
application.onDisconnect = function(client) { | |
trace("\nLOG: Syncing webcam files to data storage..."); | |
var localDir = new File("local_repo"); | |
var backupDir = new File("network_repo"); | |
if(localDir.isDirectory && backupDir.isDirectory) { | |
var lFiles = localDir.list(); | |
var iFiles = networkDir.list(); | |
for(var i = 0; i < lFiles.length; i++) { | |
var found = false; |