Category Archives: Uncategorized

Hosting your json data on cloud for free

I was working on rest api where rest services are not ready yet. I want to write my code using some dummy data. I created a json file in the same directory and start working on it. For example. ./json/mydata.json. Problem my team is facing is this data is not shared across all the UI developers. Even I face problems when I try to deploy my code on android device. I hope this is a common scenario some developer faces. I search on google and came to know, i can host my hardcoded data for free.

I Use http://myjson.com/ which is free, simple and very useful.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Closures

I like the concept of closure, even though most of us think that it is complex topic. I would not go to the detail side of the closure but I would like to let you know by using an example. I was using closure unknowingly from past 4 years. Lets cut the chase and come to the point.

 

Dont you observe, I have called the function foo() once, but it is maintaining the value of a.

So, simple definition says that, when you define any function inside a function, you are using closure, And closure function keeps the copy of all the local variable passed to them.

Thats It. Ya, Thats It.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Loading Javascript file at runtime.

There are many scenarios where you want your file to be include at run time based on your requirement. Here is the code snippet for that. I am using the Jquery.getScript method for this feature.
I came up with this idea by looking how EXTJs is forcing the folder structure in MVC architecture.

It looks like a complex example but it is not. Util.load searches for All the files which are defined in modal variable and specifically in model folder. Here it is searching for /model/Person.js

Please feel free to comment.

Facebooktwittergoogle_plusredditpinterestlinkedinmail