Skip to content

Instantly share code, notes, and snippets.

@iarie
iarie / fix_stucked_shipments.rb
Last active June 10, 2020 10:21
all in one gist
interval = Date.new(2020, 5, 1)..Date.new(2020, 6, 7)
module FixStuckShipments
FINAL_STATES = %w[
shipped
canceled
].freeze
SHIPMENT_STATUS_MAP = {
'Complete' => 'shipped',
# Get Status
get_status = -> (po_number) do
r = Supplier::Alphabroder::OrderStatusV2::GetOrderStatus.new.call(po_number)
doc = Nokogiri::XML(r.body)
nodes = doc.xpath("//order[not(shipstatus)]")
pnode = Supplier::Alphabroder::OrderStatusV2::OrderXmlNode.new(nodes)
pnode.ship_method_nodes.map do |n|
{
number: n.shipper_number,
@iarie
iarie / find_stuck_processing_shipments.rb
Last active June 8, 2020 13:35
Find stuck shipments by criteria: shipment should have similar
# May
interval = Date.new(2020, 5, 1).all_month
stock_location_ids = Spree::Supplier.alphabroder.stock_location_ids
order_ids = Spree::Order.joins(:shipments).where(
completed_at: interval,
spree_shipments: {
state: 'processing',
stock_location_id: stock_location_ids
}
brand_and_catalog_numbers = {
'Bella + Canvas' => ['BST323', 'BST323C'],
'Bayside' => ['1900J1'],
'LAT' => ['J0041', 'J0042'],
'Rabbit Skins' => ['J0051', 'J0052'],
'US Blanks' => ['USFM47'],
'Next Level' => ['NLM100', 'NLM101']
}
brand_and_catalog_numbers.each do |brand_name, catalog_numbers|
shipping_rules = [
{
brand_name: 'Bella + Canvas',
free_shipping_threshold: 200,
shipping_fees: {
fastest: 9.95,
standard: 0.00,
economy: 5.45
},
discount_coupon_allowed: false,
@jkrems
jkrems / index.md
Last active November 3, 2023 14:34
JavaScript: Classic Scripts vs. Modules vs. CommonJS

JavaScript File Format Differences

There's the pervarsive notion that all JS is created equal and that there's only minor and easily detectable differences between the various file formats used to author JavaScript. This is correct, from a certain point of view.

A certain point of view?

For many people writing JavaScript that gets passed into build tools,

@praveendhawan
praveendhawan / Spree guides notes
Created March 27, 2018 08:00
SpreeGuides Notes
Spree Guides
Products
1. Track uniq products
2. Option Types -> denote the different options for a variant
3. Option Values -> values for option types
4. Product must be assigned at least one option type if you wish to create variants for that product
5. Variants -> individual variants of a Product
6. Master Variant -> tracks basic information such as a count on hand, a price and a SKU
@briankung
briankung / docker-pry-rails.md
Last active December 12, 2023 10:40
Using pry-rails with Docker

First, add pry-rails to your Gemfile:
https://github.com/rweng/pry-rails

gem 'pry-rails', group: :development

Then you'll want to rebuild your Docker container to install the gems

@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active June 24, 2024 03:28
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@lopezjurip
lopezjurip / README.md
Last active September 10, 2023 06:27
Write to NTFS on OSX Yosemite and El Capitan

OUTDATED, see comments below

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew formulae:

brew update