if (!Array.isArray) {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
or
obj instanceof Array
web: node server |
function btoa (str) { | |
return new Buffer(str).toString('base64'); | |
} | |
function atob(str) { | |
return new Buffer(str, 'base64').toString('binary'); | |
} |
if (!Array.isArray) {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
or
obj instanceof Array
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
For watch for changes in a folder, I use incron, what is a equivalent to cronjob
See man incrontab
You must first install incron and GraphicsMagick
sudo apt-get install incron graphicsmagick
Add your username in /etc/incron.allow before to use incrontab
, then execute incrontab -e
and add the next lines (<path to watch> <file event> <script>)
/var/www/uploads/covers IN_CLOSE_WRITE,IN_DELETE /usr/local/bin/inotify.sh
$@ $ # $%
sudo apt-get install python-pip
or wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py
sudo pip install powerline-status
git clone https://github.com/powerline/fonts.git && cd fonts && sh ./install.sh
set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
> " Always show statusline
// config/env/development.js | |
/** | |
* Development environment settings | |
* | |
* This file can include shared settings for a development team, | |
* such as API keys or remote database passwords. If you're using | |
* a version control solution for your Sails app, this file will | |
* be committed to your repository unless you add it to your .gitignore | |
* file. If your repository will be publicly viewable, don't add | |
* any private information to this file! |
dd if=<origen> of=<destino> | |
watch -n 10 kill -USR1 $(pgrep -l '^dd$' | tr -d [:alpha:]) | |
pv -ptre <origen> | dd of=<destino> | |
(pv -n /dev/sda | dd of=/dev/sdb bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0 |
sudo -s | |
apt-get install php5-mcrypt | |
php5enmod mcrypt | |
service apache2 restart |
/\d{4}-\d{1,2}-\d{1,2}T\d{1,2}:\d{1,2}:\d{1,2}\+\d{4}/ |