window.Jade = require('jade'); | |
JadeTemplates = {}; | |
JadeTemplates["some_template"] = Jade.compile("li.feedback.exercise_item.checkbox\n input(type=\"hidden\", name=\"exercise[feedback_items_attributes][$order][_type]\", value=\"Checkbox\")\n\n - if (this.is_editing)\n != partial(\"item_actions\")\n\n .body\n .checkbox\n input(type=\"checkbox\", disabled, checked)\n\n .title\n - if (this.is_editing)\n input(name=\"exercise[feedback_items_attributes][$order][title]\", value=this.title, placeholder=\"E.g. "I completed this exercise"\", \"data-bvalidator\"=\"required\")\n\n - if (this.is_viewing)\n label= this.title\n"); | |
JadeTemplates["exercises/_Image"] = Jade.compile("a.image(href=this.file_url)\n\timg(src=this.file_thumb_url)\n"); | |
// defines the helpers "exercise_item" and "partial" |
(function($) { | |
$.assert = function(condition, msg) { | |
if (!condition) { | |
$.error(msg); | |
} | |
}; | |
})(jQuery); |
Handlebars.JavaScriptCompiler.prototype.nameLookup = function(parent, name, type) { | |
var result = '(' + parent + ' instanceof Backbone.Model ? ' + parent + '.get("' + name + '") : ' + parent; | |
if (/^[0-9]+$/.test(name)) { | |
return result + "[" + name + "])"; | |
} else if (Handlebars.JavaScriptCompiler.isValidJavaScriptVariableName(name)) { | |
return result + "." + name + ')'; | |
} else { | |
return result + "['" + name + "'])"; | |
} | |
}; |
The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.
However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on
var systemJsLoader = { | |
loadComponent: function (name, templateConfig, callback) { | |
if (templateConfig.systemjs) { | |
SystemJS.import(templateConfig.systemjs) | |
.then(function (viewModelCtor) { | |
callback({ | |
createViewModel: function (params, componentInfo) { | |
return viewModelCtor.viewModel(params, componentInfo); | |
}, | |
template: ko.utils.parseHtmlFragment(viewModelCtor.template) |
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' + | |
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' + | |
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' + | |
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));'; | |
try { | |
eval(str); | |
} catch(e) { | |
alert('Your browser does not support ES6!') | |
} |
var preact = require('preact'); | |
var createRenderer = require('./preact-dom-renderer'); | |
// set up a rendering target | |
var renderer = createRenderer(); | |
// render some stuff into the internal DOM | |
renderer.render(preact.h(PreactApp, pageConfig)); | |
// get a snapshot of the current HTML |
Rollup 0.48 introduces a few changes to the options
object, because the current options are confusingly different between the CLI and the options exported by your config file.
entry
is nowinput
sourceMap
andsourceMapFile
are nowsourcemap
andsourcemapFile
(note casing)moduleName
is nowname
useStrict
is nowstrict
The dest
and format
options are now grouped together as a single output: { file, format, ... }
object. output
can also be an array of { file, format, ... }
objects, in which case it behaves similarly to the current targets
. Other output options — exports
, paths
and so on — can be added to the output
object (though they will fall back to their top-level namesakes, if unspecified).