I hereby claim:
- I am fgribreau on github.
- I am fgribreau (https://keybase.io/fgribreau) on keybase.
- I have a public key whose fingerprint is 5979 F08D 8622 0A90 8A68 AA2B 33AF 768D F5E0 57AA
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env bash | |
# exit code will be != 0 if "my-website-to-check" ssl certificate (or everything else) is invalid | |
wget -nv https://my-website-to-check.com > /dev/null |
{ | |
"apps": [{ | |
"name": "My app", | |
"script": "server.js", | |
"instances": 2, | |
"port": 8080, | |
"exec_mode": "cluster_mode" | |
}], | |
"deploy": { | |
"production": { |
//This "SingletonTester" is not a valid Singleton because: | |
var InnerConstructor = SingletonTester.getInstance({ | |
pointX: 5 | |
}).constructor; | |
console.log(new InnerConstructor() !== new InnerConstructor()); // true |
$ cat package.json | grep "test" | |
"test": "zsh -c 'setopt extended_glob;mocha -t 5000 -R spec **/*.test.js~node_modules/*; zsh -i'", | |
$ npm test | |
> zsh -c 'setopt extended_glob;mocha -t 5000 -R spec **/*.test.js~node_modules/*; zsh -i' | |
(... tests start ...) |
$ cat package.json | grep "test" | |
"test": "mocha -t 5000 -R spec **/*.test.js~node_modules/*", | |
$ npm test | |
> mocha -t 5000 -R spec **/*.test.js~node_modules/* | |
/www/statwarn-monitoring-api/node_modules/mocha/lib/utils.js:494 | |
if (!files.length) throw new Error("cannot resolve path (or pattern) '" | |
^ | |
Error: cannot resolve path (or pattern) '**/*.test.js~node_modules/*' |
function getBackgroundColor (user) {
var m = user.picture.match(/avatar\/(\w+|$)/);
if (m && m[1]) {
return '#' + m[1].substring(0,6);
}
}
Bonne idée ! Quelques remarques cependant :
'use strict'; | |
/** | |
$node perfs.js | |
___________________________________________________[Bench] Generating table (size=1600000) took: 593ms | |
sum=816028274.8700228 | |
avg=510.01767179376424 | |
___________________________________________________[Bench] Calculating sum took: 78ms | |
___________________________________________________[Bench] Sort users by rank DESC took: 2702ms | |
Best score user(id=1322940, score=1010, rank=0) |
// The following script will hang on V8 regex engine. (It works fine on Safari Mac). | |
// Regex was taken from https://gist.github.com/gruber/249502 | |
"http://www.ghislainproulx.net/Blog/2014/09/contributing-to-a-github-open-source-project-(from-a-visual-studio-developer-perspective)".replace(/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi, function(url){ | |
// this will never be executed on Chrome/Node | |
console.log(url); | |
}); | |
// Checkout your CPU consumption ! |