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
// Array.contains | |
// compares searchElement to elements of the Array using strict equality | |
// (the same method used by the ===, or triple-equals, operator) and returns true or false | |
// Requires Array.indexOf. If not, see: | |
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf | |
// ex: [1,2,3].contains(2) returns true | |
if (!Array.prototype.contains) { | |
Array.prototype.contains = function (searchElement) { | |
return this.indexOf(searchElement) !== -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
// super simple | |
// all you need is the relation key, since the rest of the hypermedia control info is instead the individual items self relation | |
{ | |
"http://rel.nkstdy.co/document": [ | |
{ | |
"ean":"032cfa77face18c7ce5cdac190d34b202f4a0574eb6437427ab018b59495445c", | |
"title":"JS2", | |
"dateAdded":"2012-04-03T19:32:07.583Z", | |
"dateModified":"2012-04-05T17:22:10.796Z", |
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
{ | |
"title": "Catalog for Domenic, page 2", | |
"description": "Contains lots of books, which is cool", | |
"page": 2, | |
"pageSize": 10, | |
"_links": { | |
"prev": { "href": "/docs?page=1", "type":"application/vnd.sidearm+json" }, | |
"self": { "href": "/docs?page=2", "type":"application/vnd.sidearm+json" }, | |
"next": { "href": "/docs?page=3", "type":"application/vnd.sidearm+json" } | |
}, |
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
<!DOCTYPE html> | |
<!-- File > New Project > Templates > JavaScript > Blank App; replace default.html with this --> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>App2</title> | |
<!-- WinJS references --> | |
<link href="//Microsoft.WinJS.1.0.RC/css/ui-dark.css" rel="stylesheet" /> | |
<script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script> |
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
// Takes a snapshot of WebView control (Windows 8.1) and returns a thumbnail URL. | |
function getThumbnailFromWebView(webviewControl, width, height) { | |
return capturePreviewToBlobAsync(webviewControl).then(function (completeEvent) { | |
var blob = completeEvent.target.result; | |
var streamIn = blob.msDetachStream(); | |
var Imaging = Windows.Graphics.Imaging; | |
var transform = new Imaging.BitmapTransform(); | |
transform.scaledHeight = height; | |
transform.scaledWidth = width; |
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 xcop = require("xcop"); | |
console.log("** XCOP DEMO **\n"); | |
var options = { | |
xcopDocument: "/host/0B32WZ_OndfDhY0lkSTNaeTNvSzA/xcop.html" | |
}; | |
var origin = "https://googledrive.com"; | |
xcop(origin, options).done(function (xhr) { | |
var request = { url: "message.json" }; |
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
// Utility functions. | |
var console = { | |
log: function log(msg) { | |
var el = document.createElement("div"); | |
el.textContent = msg; | |
document.body.appendChild(el); | |
} | |
} | |
// yuzu-pns-client package. |
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
OlderNewer