These are the Glossier Engineering and Data role definitions for both teams.
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
SELECT | |
customers.first_name AS "customers.first_name", | |
(COALESCE(CAST( ( SUM(DISTINCT (CAST(FLOOR(COALESCE(customers.total_spent ,0)*(1000000*1.0)) AS DECIMAL(65,0))) + ('x' || MD5(customers.id ::varchar))::bit(64)::bigint::DECIMAL(65,0) *18446744073709551616 + ('x' || SUBSTR(MD5(customers.id ::varchar),17))::bit(64)::bigint::DECIMAL(65,0) ) - SUM(DISTINCT ('x' || MD5(customers.id ::varchar))::bit(64)::bigint::DECIMAL(65,0) *18446744073709551616 + ('x' || SUBSTR(MD5(customers.id ::varchar),17))::bit(64)::bigint::DECIMAL(65,0)) ) AS DOUBLE PRECISION) / CAST((1000000*1.0) AS DOUBLE PRECISION), 0) / NULLIF(COUNT(DISTINCT CASE WHEN customers.total_spent IS NOT NULL THEN customers.id ELSE NULL END), 0)) AS "customers.avg_spent" | |
FROM shopify.orders AS orders | |
LEFT JOIN shopify.customers AS customers ON customers.id = orders.customer__id | |
GROUP BY 1 | |
ORDER BY 2 DESC | |
LIMIT 500 |
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
#!/bin/bash | |
# install the plugins and build the static site | |
gitbook install && gitbook build | |
# checkout to the gh-pages branch | |
git checkout gh-pages | |
# pull the latest updates | |
git pull origin gh-pages --rebase |
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
staging: | |
first_thing: | |
- command: apt-get install awscli -y | |
target: any | |
execute: true | |
sudo: true | |
- source: /.cloud66/node | |
destination: /tmp/install.sh | |
target: rails | |
execute: true |
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
staging: | |
before_rails: | |
- source: /.cloud66/files/ruby_inline.sh | |
destination: /tmp/ruby_inline.sh | |
target: rails | |
halt_on_error: false | |
execute: true | |
run_on: all_servers | |
apply_during: all | |
sudo: true |
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::Order.class_eval do | |
checkout_flow do | |
go_to_state :address | |
go_to_state :delivery | |
go_to_state :payment, :if => lambda { |order| order.payment_required? } | |
go_to_state :confirm, :if => lambda { |order| order.confirmation_required? } | |
go_to_state :complete, :if => lambda { |order| (order.payment_required? && order.has_unprocessed_payments?) || !order.payment_required? } | |
remove_transition :from => :delivery, :to => :confirm | |
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
Spree::Shipment.class_eval do | |
def send_shipped_email | |
unless Rails.env.production? | |
::Spree::ShipmentMailer.shipped_email(self.id).deliver | |
end | |
end | |
end | |
Spree::Order.class_eval do | |
def deliver_order_confirmation_email |
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
# Rake task | |
desc 'Generate a list of potential orders with falsely flagged invalid payments' | |
task list_orders_with_complete_and_invalid_payments: :environment do | |
Spree::Order.complete.where(legacy: false).each do |order| | |
if order && order.has_mulitple_payments? && order.has_an_invalid_and_complete_payment? | |
puts " -> Order #{order.number} has a potentially problematic payment" | |
end | |
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
Query: | |
curl -X GET "http://localhost:9200/spree_products/spree%2Fproduct/_search?from=0&load=false&page=1&per_page=20&size=20&pretty=true" -d '{"query":{"bool":{"must":[{"query_string":{"query":"Carry","default_operator":"AND"}},{"range":{"available_on":{"lte":"2011-12-08T11:43:53Z"}}}]}},"size":20,"from":0}' | |
Returns: | |
{ | |
"took" : 7, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, |
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
module Extensions | |
module Spree | |
module Promotion | |
extend ActiveSupport::Concern | |
included do | |
alias_method_chain :order_activatable?, :no_date_limitation | |
end | |
def order_activatable_with_no_date_limitation?(order) |
NewerOlder