Installation
gem install rmagick # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse
<div class = "parent"> | |
<div class="child"> | |
<div class="child1"> | |
<div class="child2"> | |
<div class="child3"> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> |
var fs = require('fs'), | |
http = require('http'), | |
https = require('https'), | |
httpProxy = require('http-proxy'); | |
var hskey = fs.readFileSync('./***-key.pem' , 'utf8'); | |
var hscert = fs.readFileSync('./***-cert.pem' , 'utf8') | |
var options = { | |
https: { |
var Intimidate = require('intimidate'); | |
var s3Uploader = function(options) { | |
try { | |
this.client = new Intimidate(options); | |
} catch (e) { | |
return null; | |
} | |
}; |
> node index.js | |
ec2-54-234-201-7.compute-1.amazonaws.com :27017 | |
Error: No valid replicaset instance servers found | |
at /var/app/current/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/connection/repl_set/repl_set.js:446:45 | |
at null.<anonymous> (/var/app/current/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/connection/server.js:499:7) | |
at EventEmitter.emit (events.js:95:17) | |
at null.<anonymous> (/var/app/current/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:178:15) | |
at EventEmitter.emit (events.js:98:17) | |
at Socket.<anonymous> (/var/app/current/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/connection/connection.js:501:10) |
[ { queue: | |
{ client: [Object], | |
promoter: null, | |
workers: [Circular], | |
_events: {} }, | |
type: 'abc', | |
client: | |
{ stream: [Object], | |
options: [Object], | |
connection_id: 1, |
# mongo.conf | |
#where to log | |
logpath=/log/mongod.log | |
logappend=true | |
# fork and run in background | |
fork = true |
# find process holding port | |
sudo netstat -lpn |grep :80 | |
# run nginx command | |
sudo LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH /opt/nginx/sbin/nginx | |
#reload nginx | |
sudo LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH /opt/nginx/sbin/nginx -s reload | |
#get all nginx process |
var globalTime = new Date().getTime(); | |
var obj; | |
var a = function(){ | |
var i; | |
for(i=0;i<=12000;i++){ | |
obj = {}; | |
obj = null; | |
} | |
} |
1. No anonymous function give function name even in callback..V8 optimized hot function if your function do not have name then each time it get calls V8 think it is new function and tend optimize it or may not consider as hot function | |
2. Declare your object (initialized it). Adding and removing attribute on the fly is not optimized way to do things. See how V8's hidden call concept. And always initialize variable in same sequence. | |
3. use prototype to bind function to your object. | |
4. use buffer more often. Converting to 'utf8' string is costly | |
5. use 'dezalgo' module, You can find more reason behind it in link to blog post from readme of module | |
6. do not string concatenate using '+' operator create array of all string an use join method. | |
7. do not create function inside closure .. write atomic function (named function ) | |
8. assign static constant value to varible in class using prototype | |
9. Do not use delete reason hidden class optimization assign null or let GC to it's job | |
10. try to avoid number more than 31 |