Real unit test (isolation, no children render)
Calls:
- constructor
- render
// Before implementing this, you'll need to contact Shopify support and ask them to turn off Google's ReCaptcha | |
// for your Shopify store's contact forms. Otherwise, it will redirect to the captcha's verification page. | |
// Retrieves input data from a form and returns it as a JSON object: | |
function formToJSON(elements) { | |
return [].reduce.call(elements, function (data, element) { | |
data[element.name] = element.value; | |
return data; | |
}, {}); | |
} |
I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).
Use ssh keys and define host aliases in ssh config file (each alias for an account).
var getPosition = function (options) { | |
return new Promise(function (resolve, reject) { | |
navigator.geolocation.getCurrentPosition(resolve, reject, options); | |
}); | |
} | |
getPosition() | |
.then((position) => { | |
console.log(position); | |
}) |
Quand on a le choix entre deux (groupes d') instructions, il peut être opportun d'en comparer les performances avant de prolonger un développement. L'intérêt est assurément théorique : aucun utilisateur lambda ne lancera 20 000 itérations ! Cependant, une comparaison peut constituer une aide au choix.
En matière de Benchmarking, [jsPerf] (https://jsperf.com/) constitue le site de référence dans le monde du développement. Néanmoins, l'inscription est plutôt fastidieuse.
Voici pourquoi, nous présentons un code rudimentaire, sans doute perfectible, qui permet de mesurer facilement la performance d'un code en JavaScript. Ce code a été mentionné dans une conversation sur [stackoverflow] (http://stackoverflow.com/questions/111368/how-do-you-performance-test-javascript-code).
Les résultats du test s'affichent dans la console du navigateur. Ici, [Google Chrome] (https://www.google.com/chrome/browser/desktop/index.html) est commode d'emploi.
/* http://meyerweb.com/eric/tools/css/reset/ | |
v2.0-modified | 20110126 | |
License: none (public domain) | |
*/ | |
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, |
var mediaJSON = { "categories" : [ { "name" : "Movies", | |
"videos" : [ | |
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
"subtitle" : "By Blender Foundation", | |
"thumb" : "images/BigBuckBunny.jpg", | |
"title" : "Big Buck Bunny" | |
}, | |
{ "description" : "The first Blender Open Movie from 2006", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |