Skip to content

Instantly share code, notes, and snippets.


Troy Anderson theinventor

View GitHub Profile
theinventor /
Last active Aug 27, 2015
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

theinventor / sessions_controller.rb
Last active Aug 29, 2015
This is an example of a couple actions that would tie together with the omniauth/google stuff
View sessions_controller.rb
class SessionsController < ApplicationController
def new
redirect_to '/auth/google_oauth2'
def create #google oauth callback endpoint
@account = Account.find session[:account_id]
auth = request.env["omniauth.auth"]
theinventor / omniauth.rb
Created Feb 26, 2014
This is an example of the omniauth.rb configuration for getting cloud print to work
View omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
scopes = [
# we need the profile scope in order to login
# this and other scopes could be added, but match them up with the
# features you requested in your API Console
View linked-in-link.html
View Job Description
We need a new library built :)
We use cloudprint for printing, the current library was designed incredibly poorly.
It uses globals and we have print jobs going to the wrong user when we use multi-threaded workers.
We need it to be instance based, so when you get an instance using the method, the credentials are contained there in the instance - not globals.
Old library:
View togglr.rb
class Togglr
attr_accessor :client, :workspace_id
def initialize(account)
@account = account
raise "NoToken" unless @account.settings.toggl_api_token
def client
theinventor / azure_rest_client.rb
Created Apr 3, 2014
Just a quick wrapper for handling bits of the new Azure/Office 365 REST API
View azure_rest_client.rb
module WAAD
class Connector
attr_reader :client
def initialize
@client = connection(credentials)
def credentials
View example-email.html
<table border="0" cellspacing="0" cellpadding="0" style="background:#ffffff;height:100%;margin:0;padding:0;width:100%; background:#f8f8f8;">
<td width="100%" align="center" valign='top'>
<span style="color: #E8E8E8; font-size: 10px;">----- REPLY ABOVE THIS LINE TO SEND A RESPONSE -----</span><br><br>
<table width="620" border="00" cellspacing="00" cellpadding="00" style="border:1px solid #dbdbdb; background:#fff;">
<td align="left" valign="top" style=" font-family:Arial, Helvetica, sans-serif; color:#181818; font-size:16px; padding-left: 25px;" height="650"><br /><br />
theinventor / round_nearest_5.rb
Created Jun 17, 2014
Round to nearest 5 minutes in ruby, strangely this wasn't super simple to come up with..
View round_nearest_5.rb
def self.round_to_five_minutes(minute)
all = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]
higher = nil
lower = nil
all.each_with_index do |five_min,index|
if minute == five_min
return five_min
if five_min > minute
higher = five_min
View usa_epay_code_spike.rb
@gateway = login: 'KEYHERE', password: '1234', software_id: 'ABC123'
credit_card =
:number => '4000100011112224',
:verification_value => 123,
:month => 9,
:year => 2014,
:first_name => 'Bob',
:last_name => 'Bobsen'