Skip to content

Instantly share code, notes, and snippets.

View theinventor's full-sized avatar

Troy Anderson theinventor

View GitHub Profile
# -*- coding: utf-8 -*-
class LittleSchoolPhotoDownloader
def connect
@user = OpenStruct.new(email: ENV['USER'],password: ENV['PASSWORD'])
@login_url = "https://www.thelittleschool.org/user/login?destination=my-portal"
@base_url = ENV['CLASSROOM_URL']
@agent = Mechanize.new
page = @agent.get(@login_url)
@theinventor
theinventor / php_products_get.php
Created June 2, 2017 18:30
Simple example of getting products via RepairShopr API in PHP
$subdomain = "demo";
$apiKey = "abc123";
$json = file_get_contents("https://{$subdomain}.repairshopr.com/api/v1/products?api_key={$apiKey}");
$data = json_decode($json);
echo $data->{'products'};
{"account_subdomain":"repairshopr","created_at":"2016-09-08 08:42:42 -0700","delivery_tracking":"","due_date":null,"expected_date":null,"id":"78298","line_items":[{"cost":"35.0","created_at":"2016-09-08 08:42:54 -0700","id":"415104","product_id":"2722794","purchase_order_id":"78298","quantity":"10","sku":"","total":"350.0","updated_at":"2016-09-08 08:42:54 -0700"},{"cost":"0.0","created_at":"2016-09-08 13:42:44 -0700","id":"415653","product_id":"68376","purchase_order_id":"78298","quantity":"6","sku":"","total":"0.0","updated_at":"2016-09-08 13:42:44 -0700"},{"cost":"91.3","created_at":"2016-09-08 13:42:44 -0700","id":"415652","product_id":"42657","purchase_order_id":"78298","quantity":"4","sku":"","total":"365.2","updated_at":"2016-09-08 13:42:44 -0700"},{"cost":"5.0","created_at":"2016-09-08 13:42:44 -0700","id":"415651","product_id":"42","purchase_order_id":"78298","quantity":"10","sku":"","total":"50.0","updated_at":"2016-09-08 13:42:44 -0700"}],"location":null,"location_id":null,"number":"D-20160908-1","
Highcharts.chart('.RedYellowChart', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: 'Browser<br>shares<br>2015',
align: 'center',
verticalAlign: 'middle',
<?xml version="1.0" encoding="UTF-8"?>
<order>
<number>123ABC</number>
<shipping-method>UPS Ground</shipping-method>
<shipping-price type="float">34.15</shipping-price>
<status>Processed</status>
<entries type="array">
<entry>
<123123>
<quantity-requested type="integer">5</quantity-requested>
{
"number": "123ABC",
"shipping_method": "UPS Ground",
"shipping_price": 34.15,
"status": "Processed",
"entries": [
{
"123123": {
"quantity_requested": 5,
"quantity_backordered": 0,
@theinventor
theinventor / vendor_purchasing_guide.md
Last active August 27, 2015 18:36
Vendor Purchasing and Catalog Integrating with RepairShopr

So you want to get your catalog into RepairShopr or integrate automated ordering?

Last Revision: 2015-08-27, Troy

There are 2 primary ways RepairShopr can work with a Vendor (supplier, distributor, etc).

  1. We can maintain a catalog of your available products with SKUs and all the details, and make that available for our users to one-click import.
  2. We can tie into your ordering system so our users can one-click to send their Purchase Orders into your ordering system to generate a live order. (Fully Automated re-ordering is coming very soon too)

Product Catalog

idnexworkrer:
account.setup_locale
(USA) I18n.l(t.created_at.to_date) => "6/22/15"
(UK) I18n.l(t.created_at.to_date) => "22-06-2015"
def localized_created_at
end
def localized_due_date
@theinventor
theinventor / instructions.md
Last active August 29, 2015 14:23
Integrating Domo with our rails app

So - I started out learning that there is a client and server half of the setup, the idp is the Identity Provider, that is the half we were going to be - so domo could check against us.

We grabbed the gem https://github.com/lawrencepit/ruby-saml-idp

And we rolled master back to the version that was the last released gem (known state)

And.. hacked it a bit so we could pass multiple groups and a name: https://github.com/RepairShopr/ruby-saml-idp/commit/07d2df4b61296b67e4bfd6674456cbf0c51174c6

Then, in our app we did mostly what the readme said to do:

@theinventor
theinventor / snippets.html
Created May 30, 2015 13:28
add an account summary to invoices
Use this tag instead of the {{invoice_balance_due}}:
{{customer_open_balance}}
put this right below the section with the first balance due, above the line items table:
<div class="invbody">
<table cellspacing="0" class="invbody-items">
<thead>