Skip to content

Instantly share code, notes, and snippets.

Y.io(
"/pdl/api/guest/user",
{
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
},
data: Y.JSON.stringify(
{
@brianjmiller
brianjmiller / gist:4946347
Created February 13, 2013 17:28
Sample TinCanJS usage
TinCan.enableDebug();
var tincan = new TinCan (
{
recordStores: [
{
endpoint: "https://cloud.scorm.com/ScormEngineInterface/TCAPI/public/",
auth: "" // Base64 encoded string that looks like "test:password"
}
]
@brianjmiller
brianjmiller / require.config.js
Last active December 16, 2015 12:59
Loading CryptoJS with require/almond, etc.
var CryptoJS = CryptoJS || (function (Math, undefined) {^M
^M
return C;^M
}(Math));^M
define("cryptojs", (function (global) {
return function () {
var ret, fn;
return ret || global.CryptoJS;
};
@brianjmiller
brianjmiller / gist:5814668
Last active December 18, 2015 16:49
PR template for browser testing
Tested in:
- [ ] Node.js
- [ ] Chrome
- [ ] FireFox
- [ ] Safari
- [ ] IE 11
- [ ] IE 10
- [ ] IE 9
- [ ] IE 8
@brianjmiller
brianjmiller / .gitignore
Last active December 19, 2015 06:19
Simple service based on Express
/node_modules
@brianjmiller
brianjmiller / gist:6174702
Last active December 20, 2015 18:18
Example of changing view through attach/detach
_changeView: function (newView, options) {
console.log("app::_changeView");
options = options || {};
options.renderFirst = (typeof options.renderFirst !== "undefined") ? options.renderFirst : true;
if (this._currentView !== null && this._currentView === newView) {
console.log("app::_changeView - no change needed");
return;
}
if (! DEBUG) {
if (! window.console) {
window.console = {};
}
methods = ["log", "debug", "warn", "info"];
for (i = 0; i < methods.length; i++) {
console[methods[i]] = function () {};
}
}
@brianjmiller
brianjmiller / gist:6321261
Created August 23, 2013 16:24
Sample Handlebars pre-compiled template
this["JST"]["activity/denied.html"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
helpers = helpers || Handlebars.helpers; data = data || {};
return "<h2>Activity Access Denied</h2>\n";
});
@brianjmiller
brianjmiller / gist:6393294
Created August 30, 2013 19:12
Sample sequelize
Uri.findAll(
{
include: [
{ model: CurrentMetaData, as: "metadata" }
],
where: {
type: revTypeMap[type]
}
}
).then(
PasswordReset.find(
{
include: [
User
],
where: {
token: token,
"users.email": email,
expiresAt: {
gte: (new Date())