Skip to content

Instantly share code, notes, and snippets.

View schappim's full-sized avatar
💤
Sleeping . +10GMT

Marcus S schappim

💤
Sleeping . +10GMT
View GitHub Profile
/*
SD card test
This example shows how use the utility libraries on which the'
SD library is based in order to get info about your SD card.
Very useful for testing a card when you're not sure whether its working or not.
The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
require 'httparty'
require 'csv'
response = HTTParty.get 'https://docs.google.com/spreadsheets/d/1lN8dXM9y-8GwXsmMnQzYiLHypk2DvWzUAuagWM8YihI/export?format=csv'
csv = CSV.parse(response.body)
sku_tag_mapping = {}
csv.each_with_index do |row, index|
sku_tag_mapping = {
'HLO-TCCC-ST':'Twin',
'HLO-QCCC-ST':'Full/Queen',
'HLO-KCCC-ST':'King',
'HLO-TCPC-ST':'Twin',
'HLO-QCPC-ST':'Full/Queen' #etc etc...
}
order = ShopifyAPI::Order.last
puts "\nProcessing Order:"
order = ShopifyAPI::Order.last
puts "\nProcessing Order:"
url_to_order = "https://resthouse.myshopify.com/admin/orders/#{order.id}"
url_to_customer = "https://resthouse.myshopify.com/admin/customers/#{order.customer.id}"
puts "<a href=\"#{url_to_order}\" target=\"_blank\">#{url_to_order}</a><br>"
customer = ShopifyAPI::Customer.find order.customer.id
order.line_items.each do |line|
#!/usr/bin/python
# Written by pcmanbob
# https://www.raspberrypi.org/forums/memberlist.php?mode=viewprofile&u=71930&sid=78c72fd5d7f7c6d39cf3b3ddcc9a0ed5
# See: https://www.raspberrypi.org/forums/viewtopic.php?t=228207#p1399745
# Import required Python libraries
import time
import RPi.GPIO as GPIO
{
"errors": [
{
"message": "The request failed authentication",
"error_code": "API_001",
"error_name": "Unauthenticated request"
}
]
}
{% assign local_inv = product.variants.first.inventory_quantity %}
{% assign supplier_inv = product.metafields.inventory['supplier_inventory'] %}
{% if local_inv < 0 %}
{% assign local_inv = 0 %}
{% endif %}
{% if supplier_inv < 0 %}
{% assign supplier_inv = 0 %}
{"labels"=>[{"request_id"=>"3255d1dd-f116-4f3e-8dc3-9a2fe5394ce8", "status"=>"PENDING", "request_date"=>"11-02-2019 13:17:22", "shipments"=>[{"shipment_id"=>"pWgK0EyLfLsAAAFozjkjhNpY", "options"=>{}}], "shipment_ids"=>["pWgK0EyLfLsAAAFozjkjhNpY"]}]}
"PENDING"
^C^C{"labels"=>[{"request_id"=>"3255d1dd-f116-4f3e-8dc3-9a2fe5394ce8", "status"=>"PENDING", "request_date"=>"11-02-2019 13:17:22", "shipments"=>[{"shipment_id"=>"pWgK0EyLfLsAAAFozjkjhNpY", "options"=>{}}], "shipment_ids"=>["pWgK0EyLfLsAAAFozjkjhNpY"]}]}
"PENDING"
{"labels"=>[{"request_id"=>"3255d1dd-f116-4f3e-8dc3-9a2fe5394ce8", "status"=>"PENDING", "request_date"=>"11-02-2019 13:17:22", "shipments"=>[{"shipment_id"=>"pWgK0EyLfLsAAAFozjkjhNpY", "options"=>{}}], "shipment_ids"=>["pWgK0EyLfLsAAAFozjkjhNpY"]}]}
"PENDING"
{"labels"=>[{"request_id"=>"3255d1dd-f116-4f3e-8dc3-9a2fe5394ce8", "status"=>"PENDING", "request_date"=>"11-02-2019 13:17:22", "shipments"=>[{"shipment_id"=>"pWgK0EyLfLsAAAFozjkjhNpY", "options"=>{}}], "shipment_ids"=>["pWgK0EyLfLsAAAFozjkj
/*
A quick test script or the customer:
OUT --> A0
VCC --> 5V
GND --> GND
*/
#!/usr/bin/env ruby
require 'sinatra'
post '/ws' do
request.body
end