Skip to content

Instantly share code, notes, and snippets.

View mcasey8540's full-sized avatar

Mike Casey mcasey8540

View GitHub Profile
@mcasey8540
mcasey8540 / Storefront API Flow
Last active July 26, 2018 21:13
Shopify Cart -> Order
https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/object
Create New Checkout -> Add Items to Checkout -> Generate public checkout URL, save to app user in DB
When user is ready to pay, access payment logic from DB (somm vs client credit cards, etc),
use stripe token, create charge
create order in Shopify and set order as paid, save order to user in DB
delete carts after certain time period, free up inventory
@mcasey8540
mcasey8540 / Excelify: Bulk Import Export Update
Created July 26, 2018 15:07
Google Sheets Inventory sync
https://apps.shopify.com/excel-export-import
Schedule imports from Google Sheets
@mcasey8540
mcasey8540 / Write a single range
Last active July 26, 2018 14:58
Google Sheets API
https://developers.google.com/sheets/api/samples/writing
{
"range": "Sheet1!A1:D5",
"majorDimension": "ROWS",
"values": [
["Item", "Cost", "Stocked", "Ship Date"],
["Wheel", "$20.50", "4", "3/1/2016"],
["Door", "$15", "2", "3/15/2016"],
["Engine", "$100", "1", "30/20/2016"],
@mcasey8540
mcasey8540 / shopify-products-graphql.js
Last active June 9, 2018 15:53
shopify-products-graphql.json
{
shop {
products(first: 20 query: "2015") {
edges {
node {
id
handle
tags
vendor
metafields(first: 10) {
https://medium.com/@bartwijnants/using-prettier-and-husky-to-make-your-commits-save-2960f55cd351
@mcasey8540
mcasey8540 / multiple-serial-processes.js
Created February 13, 2018 16:43
multiple-serial-processes.js
'use strict';
function downloadFromService1(){
setTimeout(function(){ console.log("Hello 1"); }, 6000);
}
function downloadFromService2(){
setTimeout(function(){ console.log("Hello 2"); }, 12000);
}
@mcasey8540
mcasey8540 / rspec_rails.txt
Created November 17, 2012 02:17
rspec_rails
Rspec Notes:
-Add tests before features
rails g rspec:install
rails g integration_test <testname>
rake spec:requests
@mcasey8540
mcasey8540 / card.rb
Created October 24, 2012 23:41 — forked from dbc-challenges/card.rb
FlashCardinator
# card.rb
class Card
attr_reader :term, :definition
def initialize(term, definition)
@term = term
@definition = definition
end
@mcasey8540
mcasey8540 / card.rb
Created October 24, 2012 23:38 — forked from dbc-challenges/card.rb
FlashCardinator
# Your code here
@mcasey8540
mcasey8540 / hospital.rb
Created October 14, 2012 06:24
hospital
#People
# class Database
#
# attr_accessor :records
#
# @@max_record_id = 0
# @@records = []
#
# def next_id