Javascript Domless events

Using jQuery or nodejs makes you addicted to pubsub (publish/subscribe) model. Nodejs has nattive support for event emitters but javascript doesn’t have. Events are only binded to a DOM, using which doesn’t make sense and its also adds to performance cost. To solve the problem i wrote a custom class which implements `on` and `emit` … Read more

Converting Opensource Dictionary to JSON

Folddoc provide free online computer dictionary but they don’t have any standard tool or format to import dictionary in database or so. Dictionary can be downloaded form http://foldoc.org/Dictionary.txt Run the following nodejs code it will dump dictionary to OUTPUT.json and don’t forget to remove initial lines of disclaimer or they will add to your dictionary. … Read more

Redis Vs MongoDB

Redis and Mongodb are considered to solve a common problem that “There is something wrong with RDBMS” So what is difference ? Redis is stored in memory and swapped with disk, So data is not lost and you can enjoy performance of your RAM. (Not to be confused with Memcached it is memory only database) … Read more

Why not nodejs v4.1.1

Recently i updated nodejs installation to v4.1.1 using curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash – sudo apt-get install -y nodejs and i ended up fixing many bug in other modules, but i couldn’t move far in this decision. Nodejs has a history of breaking compatibility with older code in every new release, so if … Read more

Backup Server Configurations to Git

When you have multiple servers it pain to remember every configuration and it may take hours to configure servers again incase you need. It is also impractical to copy each files. There are few tools available but they come with overhead attached moreover its fun to write custom solutions 🙂 1. Create directory 2. cd … Read more

Cloning Server to New Hardware

You can find many ways of cloning old server to new hardware, create diskimage and move to new hardware and if you have identical hardware use `dd` or similar tool to copy disks block by block, but if you have new hardware and want to move server without downtime and with no configuration change there … Read more

Adding ellipsis to long text

When you have some long division and you don’t want to wrap text or extend size of div, But instead you want to use add few `…` at end of text using CSS .wrapped{ overflow:hidden; white-space: nowrap; text-overflow: ellipsis; width: 300px; } Example : Text without text-overflow :Lorem ipsum dolor sit amet, consectetur adipiscing elit. … Read more

Monitoring Website for Downtime

Sometimes our in house server go down, But at production level we cannot take risk of 1min downtime, so we were supposed to monitor our server for downtime. Although there are many cheap services available but i decided to do it my own way, I can use this script in my RPI to monitor even … Read more