Skip to main content

Posts

Showing posts from September, 2017

Make use of JavaScript console methods

When I say JavaScript console methods, the one and only thing that hit most of our mind is console.log() and we use it a lot and only that some might be familiar with error() and debug(). Did you ever think of checking if there are any other methods available in console other than log? Most of us don't do that, but knowing those methods might have saved lot of our development time. In this post I will show you some of the console methods which will be very useful in our day to day coding.
Log based on conditionconsole.assert(assertion, log_message); To print something on the console only if the assertion failed - assertion can be any expression which returns a boolean.
Note: In chrome this log will print as an error with message saying "Assertion failed:" with the log_message passed. In FireFox its a normal log message.
Log number of occurrence console.count([label]); If we want to count something, it may be a click, may be a callback, or event triggers. We don't …

Sync files from remote system via command line - Linux, Ubuntu, Debian

If you are using more than one laptop/computers in your day to day life for eg: Your personal laptop and Office laptop. Chances of needing a file from one laptop on the other laptop is very common. We don't want to copy the files over the system again and again. We just want the changes to the files made in one system to reflect on the other system.

In this post we will see a simple way to keep files in sync between your multiple laptops/computers. Linux has an wonderful utility called rsync which can be used to sync files/folders between systems in a very optimised way (copy only modified and new files/folders)
If you don't have rsync utility installed on your system, install it by
$ sudo apt-get update $ sudo apt-get install rsync Also we are planning to sync files from remote systems, So lets have the openssh-server installed on the both machines
$ sudo apt-get install openssh-serveropenssh-client will be by default installed on linux machines, if not install it
$ sudo apt-g…