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
readLineAsync = function(reader, timeout, buffer) { | |
var byte; | |
if (buffer == null) { | |
buffer = ""; | |
} | |
logger.trace("readLineAsync: reader.unconsumedBufferLength=" + reader.unconsumedBufferLength + " buffer=" + buffer); | |
while (reader.unconsumedBufferLength) { | |
byte = reader.readByte(); | |
if (byte === 0) { | |
logger.trace("End of stream reached, " + reader.unconsumedBufferLength + " left on reader"); |
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
writeTextAsync = (path, text) -> | |
# First try if an existing file can be written | |
Windows.Storage.PathIO.writeTextAsync(path, text) | |
.then null, (error) -> | |
[_, folder, subFolders, fileName] = /^ms-appdata:\/\/\/(temp|local|roaming)\/(.+?)\/([\w]+\.?\w+)$/.exec(path) | |
folder = "temporary" if folder is "temp" | |
createSubFolders = subFolders.split("/").reduce((promise, folderName) -> | |
promise = promise.then (folder) -> | |
folder.createFolderAsync(folderName, Windows.Storage.CreationCollisionOption.openIfExists) |
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
Public Function iso8601todate(iso As String) | |
Dim result As Date: result = DateValue(Mid(iso, 1, 10)) + TimeValue(Mid(iso, 12, 8)) | |
Dim signPos As Integer: signPos = InStr(iso, "Z") | |
If signPos = 0 Then signPos = InStr(iso, "+") | |
If signPos = 0 Then signPos = InStr(InStr(iso, "T"), iso, "-") | |
If signPos <> 0 Then | |
Dim zone As String: zone = Mid(iso, signPos) | |
Dim sign As String: sign = Left(zone, 1) | |
If sign <> "" And sign <> "Z" Then |
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 http = require('http'); | |
var pubnub = require("pubnub")({ | |
ssl : true, // <- enable TLS Tunneling over TCP | |
publish_key: 'pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', | |
subscribe_key: 'sub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
}); | |
var port = process.env.port || 1337; | |
http.createServer(function (req, res) { | |
if (req.method === "POST") { | |
var jsonString = ''; |
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
"ms-appdata:///local/conf/dailyPage.css".toStorageFileAsync() | |
.then (cssFile) => | |
style = document.createElement("style") | |
style.type = "text/css" | |
readFileAsync = -> | |
Windows.Storage.FileIO.readTextAsync(cssFile) | |
.then (cssText) -> | |
style.sheet.cssText = cssText | |
readFileAsync() | |
.then -> |
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
savesPending: 0 | |
saveAsync: () -> | |
#assert(!@finished, "Inspection already finished!") | |
logger.debug("Save requested (_cachedFile=#{@_cachedFile})") | |
if @saving | |
@savesPending += 1 | |
logger.debug("saveAsync: already saving, #{@savesPending} pending now") | |
return @saving | |
@saving = getCachedFile(@serialNumber) | |
.then (file) => |
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
define(function() { | |
return { | |
gitCommitHash: "${gitCommitHash}", | |
gitBranchDirty: ${gitPendingChanges}, | |
gitBranch: "${gitBranch}", | |
buildEnv: "${buildEnv}", | |
buildTime: "${buildTime}", | |
buildConfiguration: "${buildConfiguration}", | |
buildPlatform: "${buildPlatform}" | |
}; |
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
document.addEventListener "keydown", listener = (event) -> | |
document.removeEventListener("keydown", listener) | |
console.log(event) |
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
StorageFile = Windows.Storage.StorageFile | |
XmlDocument = Windows.Data.Xml.Dom.XmlDocument | |
define [], -> | |
exports = | |
loadFromFileAsync: (file) -> | |
return WinJS.Promise.wrapError(new TypeError("file isn't a Windows.Storage.StorageFile")) unless file instanceof Windows.Storage.StorageFile | |
settings = new Windows.Data.Xml.Dom.XmlLoadSettings() | |
settings.elementContentWhiteSpace = false | |
XmlDocument.loadFromFileAsync(file, settings) |
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
window.requireAsync = function(deps) { | |
if (arguments.length === 0) { | |
throw new TypeError("requireAsync: No dependencies given"); | |
} | |
if (typeof deps === "string" && arguments.length === 1) { | |
deps = deps.split(","); | |
} else if (!Array.isArray(deps)) { | |
deps = Array.prototype.slice.call(arguments, 0); | |
} | |
return new WinJS.Promise(function(c, e, p) { |