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
"use strict"; | |
var Q = require("q"); | |
var restify = require("restify"); | |
module.exports = function (bnCloud) { | |
return function (serverRequest, serverResponse, next) { | |
var authHeaders = serverRequest.authorization; | |
var log = (serverRequest.log && serverRequest.log.trace.bind(serverRequest.log)) || console.log.bind(console); |
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 random = Math.floor(Math.random() * 100001); | |
var sha256 = crypto.createHmac("sha256", random + "TROGDOR_THE_BURNINATOR"); | |
var timestamp = new Date().toJSON(); | |
return sha256.update(customerId + deviceToken).digest("hex"); |
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
function itemMapper(parentCourse) { | |
return function (item) { | |
return new itemViewModel(item, parentCourse); | |
}; | |
} | |
// later | |
var firstCourse = terms[0].courses[0]; | |
// inside your object literal |
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
include /mixins | |
section.reader(data-bind="event: { mousemove: revealNavigationButtons }") | |
// ko if: itemSrc | |
iframe#nere-frame(data-bind="attr: { src: itemSrc }", width="100%", height="100%", frameborder="0") | |
// /ko | |
+components("flag", "pages", "$data") | |
div(data-winning-region="navButtons") |
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
form(data-bind="submit: signIn") | |
block content | |
+signInErrorMessage() | |
+signInInputs() | |
+signInSubmitButton() |
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
// requirejs aka "AMD" module | |
define(["./utils", "./userService"], function (utils, userService) { | |
// everthing in here is my module | |
}); | |
define(function (require) { | |
var utils = require("./utils"); |
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
/* | |
Sweet.js macros for privacy sugar. | |
Below could be rewritten using es6 weakmaps. | |
*/ | |
macro privacy { | |
rule {} => { | |
var id = ++privates.id | |
var privMap = {} | |
this.__id = id | |
privates[id] = privMap |
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
ko.applyBindingsToDescendants = (function (original) { | |
return function (childBindingContext, element) { | |
var insertionNodes = ko.utils.domData.get(element, "insertionNodes"); | |
original.apply(ko, arguments); | |
if (insertionNodes) { | |
transcludeInto(element, insertionNodes); | |
} | |
}; |
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
if (length >= 3 && isIndeterminate) { | |
isIndeterminate = false; | |
} else if (length > 0 && length < 3 && !isIndeterminate) { | |
that.hasError(true); | |
} else { | |
that.isQueryTextInvalid(true); | |
that.hasError(false); | |
} |
OlderNewer