Skip to content

Instantly share code, notes, and snippets.

@p15martin
p15martin / client.js
Created February 8, 2012 02:56
Service discovery
var mqtt = require('mqttjs');
var mdns = require('mdns');
var topic = "my.data";
var connectedClient = null;
discoverService();
startMessageLoop();
/*jslint node:true */
'use strict';
var Sequelize = require('Sequelize'),
Q = require('q'),
http = require('http'),
sequelize = new Sequelize('gfdb', 'gfuser', 'password', {
host: 'localhost',
dialect: 'postgres',
@p15martin
p15martin / user-info.js
Last active August 29, 2015 13:57
This Gist is a simple spike, which demonstrates authentication with Concur and retrieval of the user's profile information. To use it sign up for a developer sandbox at Concur (https://developer.concur.com), once you have registered it will create a default app and display your API key.
/*jslint node:true */
var https = require('https'),
util = require('util'),
libxmljs = require("libxmljs"),
Q = require('q'),
concurHost = 'www.concursolutions.com';
function httpGet(httpOptions) {
'use strict';
@p15martin
p15martin / autotools-init.sh
Last active August 29, 2015 14:17
Initialize a project for Autotools. I take no credit, it all goes to Reuben Brasher for taking the time to learn Autotools. This version all incorporates the changes introduced in the fork created by horixon (Justin Wagle).
#!/bin/bash
set -e
createDirectoryStructure()
{
mkdir -p include
mkdir -p src
mkdir -p m4
}
import SwiftyDropbox
import Foundation
extension CallError {
var errorCode: Int? {
switch self {
case .InternalServerError(let code, let message):
return code
case .HTTPError(let code, let message):
return code
@p15martin
p15martin / foo.js
Created April 15, 2020 23:40
Debug
/// debug
const page1 = {"transactions":[{"id":"9ebee3e75062477e868aa263b2c2e861","description":"CD DEPOSIT .INITIAL.","is_pending":false,"order":"1586992384719.732","amount":"1000.00","provider_amount":"1000.00","currency":"USD","classification":0,"merchant_name":"Cd Deposit Initial","provider_merchant_name":"Cd Deposit Initial","merchant_name_and_location":"","category_id":"1ce8af1d77aa4c7eaf8ccb1b9eadbf76","provider_category":"Transfer","provider_category_id":"1ce8af1d77aa4c7eaf8ccb1b9eadbf76","category":"Transfer","category__icon_url":"https://spendstatichosting.blob.core.windows.net/icons/icon-categories-default-new@3x.png","auto_categorized":false,"purchase_type":"special","transaction_date":"2020-04-14T00:00:00","provider_transaction_date":"2020-04-14T00:00:00","is_deleted":false,"posting_date":"2020-04-15T23:13:04.719779","created":"2020-04-15T23:13:04.723897","modified":"2020-04-15T23:13:04.723938","get_classification_display":"Unclassified","transaction_id":"dde8edf22aba478e9d98b9d522137b68"
$("#setup").click(() => tryCatch(setup));
$("#insert-range").click(() => tryCatch(insertRange));
$("#delete-range").click(() => tryCatch(deleteRange));
$("#clear-range").click(() => tryCatch(clearRange));
async function insertRange() {
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const range = sheet.getRange("B4:E4");
$("#setup").click(() => tryCatch(setup));
$("#insert-range").click(() => tryCatch(insertRange));
$("#delete-range").click(() => tryCatch(deleteRange));
$("#clear-range").click(() => tryCatch(clearRange));
async function insertRange() {
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
@p15martin
p15martin / Clear and untrack a range.EXCEL.yaml
Created August 13, 2020 16:25
Clear and untrack a range
name: Clear and untrack a range
description: Clear and untrack a range
host: EXCEL
api_set: {}
script:
content: |
$("#setup").click(() => tryCatch(setup));
$("#insert-range").click(() => tryCatch(insertRange));
$("#delete-range").click(() => tryCatch(deleteRange));
@p15martin
p15martin / Clear and untrack a range.EXCEL.yaml
Created August 13, 2020 16:25
Clear and untrack a range
name: Clear and untrack a range
description: Clear and untrack a range
host: EXCEL
api_set: {}
script:
content: |
$("#setup").click(() => tryCatch(setup));
$("#insert-range").click(() => tryCatch(insertRange));
$("#delete-range").click(() => tryCatch(deleteRange));