npm install cordova
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 page = require('webpage').create(); | |
var system = require('system'); | |
page.onResourceRequested = function (request) { | |
system.stderr.writeLine('= onResourceRequested()'); | |
system.stderr.writeLine(' request: ' + JSON.stringify(request, undefined, 4)); | |
}; | |
page.onResourceReceived = function(response) { | |
system.stderr.writeLine('= onResourceReceived()' ); |
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 async = require('async'); | |
var sizes = [ | |
[320, 480], | |
[600, 1024], | |
[1024, 768], | |
[1280, 800], | |
[1440, 900] | |
]; | |
var url = 'http://one-pager.dev/nl'; |
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
// Code to be run by PhantomJS. | |
// The docs for these modules are here: http://phantomjs.org/api/ | |
// Note that the 'fs' module here has a different API than the one in node.js core. | |
var webpage = require('webpage'); | |
var system = require('system'); | |
var fs = require('fs'); | |
var page = webpage.create(); | |
var inc = 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
Array.apply(null, [1, 2, 3]) | |
> [1, 2, 3] | |
Array.apply(null, [1, 2, 3]).length | |
> 3 | |
Array.apply(null, {length:3}) | |
> [undefined, undefined, undefined] | |
Array.apply(null, {length:3}).length |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
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
define([],function() { | |
var iframe=document.createElement("iframe"); | |
iframe.src="about:blank"; | |
iframe.setAttribute("style","display:none;visibility:hidden;"); | |
document.body.appendChild(iframe); | |
var d=iframe.contentWindow.document; | |
d.charset=d.characterSet="GBK"; | |
function getGBKEscape(s) { | |
d.write("<body><a href='?"+s+"'>X</a></body>"); | |
d.close(); |
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
// Note that instance and class methods could also be defined at the adapter level | |
// (e.g. CRUD adapters add .save() and .destroy() methods, but the Twillio API might add a .call() method) | |
// User.js | |
module.exports = sails.Model.extend({ | |
// Adapters are applied from left to right | |
// (methods defined in more than one adapter use the rightmost adapter's version, just like _.extend) | |
adapter: ['mysql', 'twilio'], | |
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
// @license http://opensource.org/licenses/MIT | |
// copyright Paul Irish 2015 | |
// Date.now() is supported everywhere except IE8. For IE8 we use the Date.now polyfill | |
// github.com/Financial-Times/polyfill-service/blob/master/polyfills/Date.now/polyfill.js | |
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values | |
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page | |
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed |
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
/** | |
* Allow other processes to execute while iterating over | |
* an array. Useful for large arrays, or long-running processing | |
* | |
* @param {Function} fn iterator fed each element of the array. | |
* @param {Function} next executed when done | |
*/ | |
Array.prototype.nonBlockingForEach = function(fn, next) { | |
var arr = this; | |
var i = 0; |