Skip to content

Instantly share code, notes, and snippets.

var oauth_nonce = createGuid();
var oauth_timestamp = (new Date().getTime()/1000).toFixed();
var signBase = 'GET' + '&' + encodeURIComponent(requestURL) + '&' +
encodeURIComponent( complexQuery + '&oauth_consumer_key=' + CONSUMER_KEY + '&oauth_nonce=' +
oauth_nonce + '&oauth_signature_method=' + oauth_signature_method + '&oauth_timestamp=' +
oauth_timestamp + '&oauth_token=' + CONSUMER_KEY + '&oauth_version=' + oauth_version + '&page=' + pageNo);
var hSig = rsa.signString(signBase, hashAlg);
var oauth_signature = encodeURIComponent(hextob64(hSig));
@zirinisp
zirinisp / xero-google-script.gs
Created June 23, 2019 10:06
Xero Google Script Integration
// Got the code from https://github.com/csi-lk/google-app-script-xero-api
var API_END_POINT = 'https://api.xero.com/api.xro/2.0';
var INVOICES_END_POINT = '/Invoices';
// Working method to send a request with a payload
function sendRequest(endpoint, method, payload) {
var url = 'https://api.xero.com/api.xro/2.0' + endpoint
var authHeader = getAuthHeader(method, url);
var headers = {
@zirinisp
zirinisp / gist:80815c253ae493329153a02c41efecfa
Created June 23, 2019 10:04
Xero Google Script Integration
We couldn’t find that file to show.
@zirinisp
zirinisp / Firecloud Nearby GeoQuery
Created April 27, 2018 08:30
Firecloud Nearby GeoQuery
import CoreLocation
extension CLLocationCoordinate2D {
func boundingBox(radius: CLLocationDistance) -> (max: CLLocationCoordinate2D, min: CLLocationCoordinate2D) {
// 0.0000089982311916 ~= 1m
let offset = 0.0000089982311916 * radius
let latMax = self.latitude + offset
let latMin = self.latitude - offset
// 1 degree of longitude = 111km only at equator
@zirinisp
zirinisp / ZohoIagtmEndOfDayReport
Created November 4, 2017 18:24
Zoho Creator Script for End of Day Report on Zoho Books
// Slack Urls
debugSlackUrl = "https://hooks.slack.com/services/...";
eodReportSlack = "https://hooks.slack.com/services/...";
// Zoho Books
zohoBooksOrganisationId = "...";
cashCustomerId = ...;
creditCardCustomerId = ...;
otherCustomerId = ...;
zohoBooksPettyCashAccountId = ...;
// Zoho Invoice
@zirinisp
zirinisp / SlackLogger.swift
Created July 1, 2017 12:17
Slack Logger for Swift Kitura
import Foundation
import LoggerAPI
import KituraRequest
import SwiftyJSON
struct SlackField {
var title: String
var value: String
var short: Bool = false