This file contains 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
this.oninstall = function(e) { | |
// Create a cache of resources. | |
var resources = new Cache(); | |
var visited = new Cache(); | |
// Fetch them. | |
e.waitUntil(resources.add( | |
"/index.html", | |
"/fallback.html", | |
"/css/base.css", | |
"/js/app.js", |
This file contains 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
store.match('/api.json').then(function(response) { | |
return response || store.prime('/api.json'); | |
}).then(asJSON).then(updatePage).catch(displayError); |
This file contains 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
} |
This file contains 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 ENV_REGEXPS = {}; | |
for (var k in process.env) { | |
ENV_REGEXPS["[" + k + "]"] = new RegExp(escRegExp(process.env[k]), "g"); | |
} | |
// Make sure ENV VARS don't accidentally end-up in a log. | |
// Note this opens up the risk of ENV VARS being | |
// leaked if known content contains the value of ENV VARS. | |
var log = kue.Job.prototype.log; | |
kue.Job.prototype.log = function() { | |
var str = arguments[0]; |
This file contains 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 fs = require("fs"); | |
var browserify = require("browserify"); | |
var through2 = require("through2"); | |
module.exports = function(input, output, callback) { | |
var inputstream = fs.createReadStream(input).on("error", callback); | |
var isEmpty = through2( | |
function (chunk, enc, cb) { | |
if (this._notEmpty || (/\S/).test(chunk)) this._notEmpty = true; | |
cb(null, chunk); |
This file contains 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
# original sentence: | |
You need to run JS to scrape things off of web pages with client-side logic so now you need Selenium for web scraping. | |
# what I understood: | |
"You need to run JS to (scrape things off of web pages with client-side logic) so now you need Selenium for web scraping." | |
i.e. the scraping needs client side logic | |
# what retorspecitvely I think you meant | |
"You need to run JS to scrape things off of (web pages with client-side logic) so now you need Selenium for web scraping." | |
i.e. the web page has client side logic |
This file contains 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 highlight(str, searchString) { | |
var regexp = new RegExp("(<[^>]+>)|(" + searchString + ")", "gi"); | |
return (str || "").replace(regexp, function wrap(_, tag, txt) { | |
if (tag) return tag; | |
return "<strong class=\"highlight\">" + txt + "</strong>"; | |
}); | |
} |
This file contains 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
{ | |
"html5": { | |
"authors": [ | |
"Ian Hickson", | |
"Robin Berjon", | |
"Steve Faulkner", | |
"Travis Leithead", | |
"Erika Doyle Navara", | |
"Edward O'Connor", | |
"Silvia Pfeiffer" |
This file contains 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 uniq(sortedArray) { | |
var output = []; | |
sortedArray.reduce(function(previous, current) { | |
if (current != previous) { | |
output.push(current); | |
} | |
return current; | |
}, null); | |
return output; | |
} |
This file contains 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
module.exports = { | |
_id: "_design/xxx", | |
views: { | |
by_date: { | |
map: function(doc) { | |
var parts = doc._id.split(":"); | |
emit(parts, { shortname: parts[0], date: parts[1] }); | |
} | |
}, | |
updates_by_date: { |