Skip to content

Instantly share code, notes, and snippets.

View rjaus's full-sized avatar

Riley James rjaus

View GitHub Profile
@rjaus
rjaus / s3-xero-attachment-upload.js
Created February 14, 2018 01:14
Read s3 bucket object and upload to Xero as attachment example code
// AWS s3
const aws = require('aws-sdk');
aws.config.loadFromPath('./aws.json');
aws.config.update({region:'us-east-1'});
const s3 = new aws.S3();
// Xero client
const xero = require('xero-node')
const fs = require('fs')
const config = require('./xero.json')
@rjaus
rjaus / index.rb
Created March 9, 2018 00:54
Xero Webhooks ITR Example for Ruby Sintra
require 'sinatra'
require 'base64'
require 'openssl'
post '/webhook' do
payload = request.body.read
key = "WEBHOOKS_KEY"
signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key, payload)).strip()
@rjaus
rjaus / xero.json
Created April 10, 2018 01:44
Xero Config JSON file (for node)
{
"userAgent" : "Riley Tierion Example",
"consumerKey": "FUTDJTYEWGSKVVCKKWQFJTDJSURDEY",
"consumerSecret": "DHSURTYDPDXOKAZ6DUIQRGTJDTUYFD",
"privateKeyPath": "./privatekey.pem",
"webhookKey": "ByxdfkFMZd0+wLsd1UV/yF/+oMzhhTD5PiETFidppgY7x6v7woYwutDiyijQKXg2m2WFJDTSlaykJOh910xWtg=="
}

my mail is rj (AT) rileyjames.co

@rjaus
rjaus / appstore.md
Last active April 1, 2021 09:24
What's going on in the app store?!

What's going on in the app store??

@rjaus
rjaus / sequelize-model-sync.js
Created August 4, 2021 05:47
sequelize model & sync
'use strict';
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class Service extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.
@rjaus
rjaus / sequelize-models-json-jsonb.js
Created August 4, 2021 05:58
Sequelize JSON vs JSONB with Postgres
'use strict';
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class Service extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.