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
# create the swapfile: | |
fallocate -l 1G /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
# enable it: | |
swapon /swapfile | |
sysctl vm.swappiness=10 | |
sysctl vm.vfs_cache_pressure=50 |
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 startWatchingMemory() { | |
if (process.env.MEMWATCH) { | |
var memwatch = require('memwatch-next'); | |
var heapdump = process.env.HEAPDUMP && require('heapdump'); | |
var hd = null; | |
memwatch.on('leak', function(info) { | |
log(info); |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
INSTALL_NODE = <<SCRIPT | |
sudo add-apt-repository -y ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install -y nodejs |
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 arr1 = [ { name: 'Nikki' }, { name: 'Jason' }, { name: 'Thanh' } ]; | |
var arr2 = [ { name: 'Nikki' }, { name: 'Thanh' } ]; | |
var index = {}; | |
arr1.forEach(function(item) { | |
index[item.name] = item; | |
}); | |
console.log(index); |
NewerOlder