This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gulp = require('gulp'); | |
const build = require('@microsoft/sp-build-web'); | |
build.addSuppression("Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe."); | |
build.configureWebpack.mergeConfig({ | |
additionalConfiguration: (generatedConfiguration) => { | |
generatedConfiguration.externals = generatedConfiguration.externals | |
.filter(name => !(["react", "react-dom"].includes(name))) | |
return generatedConfiguration; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Eventer { | |
constructor() { | |
this.events = {}; | |
} | |
ensureEvent(key) { | |
return this.events[key] || (this.events[key] = { subscriptions: [] }); | |
} | |
on(key, cb) { | |
if (typeof cb !== "function") throw new Error("You must pass a function when you subscribe"); | |
this.ensureEvent(key).subscriptions.push(cb); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var find = exports.find = function(selector) { | |
return [].slice.call(document.querySelectorAll(selector), 0); | |
}; | |
var findOne = exports.findOne = function(selector) { | |
return document.querySelector(selector); | |
}; | |
var getClassList = exports.getClassList = function(elem) { | |
return elem.className.split(" ").map(c => c.trim()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EventAggregator = require("droopy-events"); | |
var touchEvents = ["touchstart", "touchmove", "touchend"]; | |
var defaultOptions = { | |
swipeLength: 30 | |
} | |
// Store initial values to make reset easier | |
var defaultSwipe = { | |
start: { x: -1, y: -1 }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createChangeToken = function(date,listId) { | |
//Change token format: | |
// http://sharepoint.stackexchange.com/questions/194152/sharepoint-sharepoint-online-how-can-i-create-changetoken-without-using-msft-li | |
// The tricky part is the .NET ticks (micrsseconds since 1/1/1) | |
// Got the static number by running C#: | |
// (DateTime.MinValue.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds | |
// Add the static milliseconds since 1/1/1 to the JS milliseconds since 1/1/1970 | |
console.log(date); | |
console.log(new Date()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var middlewarify = function(pre, done) { | |
var middleware = []; | |
var func = function(...args) { | |
if (done) middleware.push(done); | |
return middleware.reduce( (chain, fn) => chain.then(fn) | |
, Promise.resolve(pre.apply(null, args))) | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var middlewarify = function(pre, done) { | |
var middleware = []; | |
var func = function(...args) { | |
if (done) middleware.push(done); | |
return middleware.reduce( (chain, fn) => chain.then(fn) | |
, Promise.resolve(pre.apply(null, args))) | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var middlewarify = function(pre, post) { | |
post = post || function(next) { next() } | |
var doIt = function(next, params) { | |
return pre(next, params); | |
} | |
var func = function(params) { | |
func.use(post) | |
return new Promise((resolve, reject) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// THIS IS A NODEJS WEB SERVER RUNNING ON PI | |
var bodyParser = require("body-parser"); | |
var express = require("express"); | |
var createGuid = require('node-uuid').v4; | |
var app = express(); | |
app.use(bodyParser.json()); //to handle POST body | |
// THESE DONT EXIST YET | |
var azureCam = require("azure-cam"); // bschlintz npm published module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var storage = localStorage; | |
var cache = {}; | |
cache.setStorageType = function(localOrSessionStorage) { | |
storage = localOrSessionStorage | |
} | |
var _isExpired = function(cacheValue) { | |
return (cacheValue.expiration) && ((new Date()).getTime() > cacheValue.expiration); | |
}; |