A guide to your Digital Life.

Music, Movies and Life

I love watching Movies and I love Music. They are almost inseperable part of life. I love the way they could touch and move your life more than you could imagine. I remember watching "The Social Network" almost 50 times in college. It served as a push to write more code and do awesome in life.

Well, it might sound really strange but for last 10 years or so. I just let life flow in the natural way. I failed quite sometimes, achieved success as well. Made some long lasting friends, lost some people I felt who were my friends.

The great thing is that in all these experiences, I realised that what is the true purpose of my life. They say, there are just two important days in your life.

The day when you are born, and the day you find out why?
I think I just found out the purpose of my life. It's not something I would want to disclose and claim I am going to achieve. It is the way my thinking changed and the choice of life I am going to make.

Also, I would love to thank the wonderful readers of this blog - which initially started casually just to empty my mind on topics I felt were relevant at that time. For sure there are some not so good posts as well. But again, this blog is just me writing what comes in my mind. And if some of those helps someone or guide someone. Why not?

Happy New Year 2014

A very happy new year to all the readers of this blog. To start with, I would try to publish a post at least once a week so that it may satisfy your appetite on a regular basis. Also, I am meditating about something new on this blog. It will be revealed when the time comes. With that said, have an amazing start to the year.

Using HTML5 localStorage Into Your App, Check ldb.js

Last night, I was hacking on a small utility library for use when using HTML5 localStorage. When you work with localStorage, it often gets into repetitive state when use use same command again and again. This library just abstracts the process and makes things easier for you. It would work on all modern browsers.

/**
* Ldb.js
* Copyright(c)2013 Vinit Kumar
* MIT Licensed
*/

var Ldb = function () {};

/**
* [check Checks for localStorage support on the browsers]
* @return {[String]} [status of localStorage Support]
*/
Ldb.prototype.check = function () {
if (!localStorage) {
return 'Please use a Modern browser, your browser does not support localStorage yet';
} else {
return 'Bingo, your Browsers supports localStorage, phew!';
}
};

/**
* [get Gives the data stored in the key]
* @param {[String]} key [Key to retrive the data stored in localStorage]
* @return {[JSON]} [The JSON data stored | Error message saying no data stored with that key]
*/
Ldb.prototype.get = function (key) {
if (localStorage.getItem(key)) {
return JSON.parse(localStorage.getItem(key));
} else {
return 'No such key exists, Are you sure you have saved data with the key?';
}
};

/**
* [set Saved data in the localStorage database]
* @param {[String]} key []
* @param {[JSON]} value [The JSON data that gets stored in the localStorage]
*/
Ldb.prototype.set = function(key, value) {
if (typeof (value) === 'object') {
var stringValue = JSON.stringify(value);
localStorage.setItem(key, stringValue);
return 'Successfully saved your data to the key' + key +' key!';
}
};

/**
* [remove description]
* @param {[String]} key [Key for the data to be deleted]
* @return {[String]} [Status message for the remove operation]
*/
Ldb.prototype.remove = function(key) {
if (localStorage.getItem(key)) {
localStorage.removeItem(key);
return 'Successfully removed data with the key'+ key +' !';
} else {
return 'No such key exists, nothing to remove';
}
};



This is all code for the utility as of now. More features are going to flow in coming weeks. Also, you can just install it using 'npm install ldb' or 'bower install ldb.js'. The code is Open Sourced here. https://github.com/vinitkumar/ldb.js