Skip to content

Instantly share code, notes, and snippets.

View jeromyevans's full-sized avatar

Jeromy Evans jeromyevans

  • California
View GitHub Profile
@jeromyevans
jeromyevans / gist:1d2b7e390a699b26da2d
Created June 10, 2015 06:11
Configure the endpoints for three-legged oauth with Xero
// this is the user-accessed resource that initiates the authentication with xero.
// the user will eventually be redirected to Xero's authorize page
server.route({
method: 'GET',
path: '/authenticate',
handler: function(request, reply) {
XeroClient.requestXeroRequestToken(request, reply);
}
});
@jeromyevans
jeromyevans / gist:a5fdcf6849ead322aeee
Created June 10, 2015 06:13
Configure oauth package to work with Xero API
// Xero API defaults to application/xml content-type
var customHeaders = {
"Accept" : "application/json",
"Connection": "close"
};
var oauth = new OAuth.OAuth(
REQUEST_URL,
ACCESS_URL,
CONSUMER_KEY,
@jeromyevans
jeromyevans / gist:4ef8239cdc95f34426e7
Created June 10, 2015 06:31
Request the Xero Access Token
// Perform the callback leg of the three-legged oAuth.
// Given the auth_token and auth_verifier from xero, request the AccessToken
exports.requestXeroAccessToken = function(request, reply) {
var oAuthToken = request.query["oauth_token"];
var oAuthVerifier = request.query["oauth_verifier"];
var org = request.query["org"];
var oAuthData = request.session.get('oauth');
@jeromyevans
jeromyevans / gist:f30a6cb47e08bb2f778f
Created June 10, 2015 06:34
Use oauth to GET a Xero endpoint
oauth.get('https://api.xero.com/api.xro/2.0/Organisation',
oauth_access_token,
oauth_access_token_secret,
function (e, data, res) {
if (e) {
console.error(e);
return;
}
var oResponse = JSON.parse(data);
@jeromyevans
jeromyevans / gist:c730047c0ec03cc188ee
Created June 10, 2015 06:36
Request Xero Request Token
// Initiate the request to Xero to get an oAuth Request Token.
// With the token, we can send the user to Xero's authorize page
exports.requestXeroRequestToken = function(request, reply) {
oauth.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results) {
if (error) {
console.log(error);
return reply.view('failed');
@jeromyevans
jeromyevans / gist:617e25ca90ed1d9e32e75872b6cd5d37
Last active September 10, 2017 17:47
Fitbit Aria Terminal Simple Power-on from battery
Built on Feb 29 2016 15:11:54
Config lost - RTC invalid - external reset/power failure
04003660: 20 f8 5e a
b 21 55 ff ff 39 35 30 45
04003680: 45 41 41 44 37 32 42 30 36 35 46 36 43 39 34 36 36 43 37 30 43 44 41 3
9 42 39 37 41 93 2c 80 00
040036a0: 01 02 ff ff
Flojo App version 39, WFW version 2c0200
Boot time 0
@jeromyevans
jeromyevans / tap-poweron.txt
Last active November 20, 2016 20:04
Fitbit ARIA Terminal After Tapping Power
Built on Feb 29 2016 15:11:54
04003660: 20 f8 5e a
b 21 55 ff ff 39 35 30 45
04003680: 45 41 41 44 37 32 42 30 36 35 46 36 43 39 34 36 36 43 37 30 43 44 41 3
9 42 39 37 41 93 2c 80 00
040036a0: 01 02 ff ff
Flojo App version 39, WFW version 2c0200
Boot time 1456758918
Time now 1456758918
@jeromyevans
jeromyevans / power-on-and-hold.txt
Last active November 20, 2016 20:05
Fitbit ARIA Terminal Power-on and Hold Test
Built on Feb 29 2016 15:11:54
04003660: 20 f8 5e a
b 21 55 ff ff 39 35 30 45
04003680: 45 41 41 44 37 32 42 30 36 35 46 36 43 39 34 36 36 43 37 30 43 44 41 3
9 42 39 37 41 93 2c 80 00
040036a0: 01 02 ff ff
Flojo App version 39, WFW version 2c0200
Boot time 1456759024
Time now 1456759024
@jeromyevans
jeromyevans / measurement.txt
Last active November 20, 2016 20:06
Fitbit Aria Terminal Log - Full measurement test
Built on Feb 29 2016 15:11:54
04003660: 20 f8 5e a
b 21 55 ff ff 39 35 30 45
04003680: 45 41 41 44 37 32 42 30 36 35 46 36 43 39 34 36 36 43 37 30 43 44 41 3
9 42 39 37 41 93 2c 80 00
040036a0: 01 02 ff ff
Flojo App version 39, WFW version 2c0200
Boot time 1456760456
Time now 1456760456
@jeromyevans
jeromyevans / interactive-log.txt
Created November 20, 2016 20:39
Fitbit Aria Interactive Terminal
Built on Feb 29 2016 15:11:54
Config lost - RTC invalid - external reset/power failure
04003660: 20 f8 5e a
b 21 55 ff ff 39 35 30 45
04003680: 45 41 41 44 37 32 42 30 36 35 46 36 43 39 34 36 36 43 37 30 43 44 41 3
9 42 39 37 41 93 2c 80 00
040036a0: 01 02 ff ff
Flojo App version 39, WFW version 2c0200
Boot time 0