Skip to main content

Posts

Showing posts from 2016

Validate JSON within Node.js with is-good-json npm package.

This is a simple npm package to determine if the given JSON is valid or invalid. Again, it parses the given file in the proper format if it is valid. So you don't have to parse it by your own.

Visit is-good-json npm package.
Just #published another #npm package 'is-good-json' to validate a #json file internally in an #app.https://t.co/DJbdYDPQmg#Nodejs 👨🏽‍💻 pic.twitter.com/tx49kNQCLv — Vajahath (@vajahath7) December 27, 2016

Building node.js applications on Google Cloud Platform.

found this as very inspiring and informative.

npm lme 1.2.0 is out !

I had published an npm package named lme, to console.log() better. (read the post)

v1.2.0 of the lme npm package is out now. This version covers some additional features for drawing lines and some support for node's default output methods such as trace and info. Thanks to @amandeepmittal for #2.

Visit the lme npm package.

Install / Update lme
npm install --save lme

#npm lme 1.2.0 is out #now with more features and bug fixes. https://t.co/owrOMzAFBi#install#update#NodeJS#javascript#colorful#funpic.twitter.com/myAUGjq7EW — Vajahath (@vajahath7) November 23, 2016

lme: console.logging done right.

Visit the lme npm package.
I've been using Node.js for last 2 years. Till then, whenever I wanted to output just a "hi" it requires me to write the entire 13 char long console.log(). I'm lazy enough to write that hard.

It is even insane to find something that console-ed out to the terminal from a pool of texts. If you are using the morgan npm package, then it requires no time to fill up your terminals with loads of text. We need all. Morgan is a great tool for logging HTTP requests. How can we develop an app ignoring the outputs of Morgan!? At the same time, we also need out custom outputs.

Well, there is a great package called chalk. Yeah, it's wonderful with much color. So if you need to output something to console with colors, use chalk. But it takes even longer to construct your console.log() statements. You need to individually style each of your statements.

The lme package
To handle all these shortcomings, I just published a simple npm package named lme(sta…

Hello World in MongDB.

On 15th January 2016, Divin, one of my best friends sent me a message in Whatsapp.
Greetings from ICT Academy of Kerala,

We are pleased to invite your college to participate in the ICT Academy of Kerala’s Student Magazine to be released in 2016. Students may submit articles related to technology(all engineering disciplines), social innovation, individual and  group projects. The submitted articles which will be reviewed by ICT Academy of Kerala’s editorial board before incorporating it to Student’s Magazine . The ICTAK Students Magazine will be a unique blend of articles by students from your college and the industry. The best student article will be rewarded by ICT Academy of Kerala.
 Articles to be send to this email id: <divin's email>
 Please ensure the following steps to submit the articles.
 1)      Articles should be related to technology(all engineering discipline), social innovation, individual and group projects.
2)      Articles should not be more than 2-3 pages.

Polymer element to make a success feel to user.

Some days ago our team lead told me they want something like this. I produced one and gave it back.
But I thought I could make a stand alone custom element so that it can be reused a hundred times without writing the entire bulky code.
I published an npm package here: https://www.npmjs.com/package/successful-operation
Here is the docs:

It's a special feeling when I code wired-in with this;
#energized;

Lots of things during this break. And finally an npm package.

Well, lots of things happened during this break! Thank God, most of them were funny and good, except one can invoke curiousness ( I'll mention that in my later post).

I've been learning some UX principles these days as I got a job as UXD in a major company.
I'm gonna dive into Polymer. cz that's what's gonna save my time. Thus as the first step, I published an npm package which is a Polymer custom element. Good news is version 1.0.9 of the element is out today.


Even though the package is not intended to blow your mind, it helped me to understand the basic polymer principles. So I invite you guys to give a try there. The documentation is also provided with the package.



Save a lot by modularizing your CSS.

I recently published an article on facebook discussing a good practice in CSS that we should follow.

At my baby steps in designing (mm may be 3 yrs ago) I wrote a new class for each element and styled them. The funniest thing was most elements had the same style. First styled a class, then copy-pasted to a dozen times. Finally I used to look at them and think "God! I wrote this much!", in which most of them are repetitions which are ctrl+vd. Those days were the funniest..

When I learned Bootstrap, I really liked the way they modularized their CSS. Then I started doing that modularization my own.
Now here is a note for kids who are getting started.

Find what's goin on my editor

I think it's nice to make the coding more documented, or may be.. can I say simultaneous blogging? I don't know. Let it be whatever you call it. I'm gonna do that stuff here or on facebook.
"A live mad thought update from my wandering mind". Eh.! did i really said that?!

Piano is beautiful #Yiruma

Yiruma, (이루마) - Reminiscent

How to keep a user logged in?

Hi everyone,
Let's prepare some Cookies this time...

I've been searching for a secure method for keeping a user logged in. You knew that's easy by keeping sessions in server side. Well, I'm not referring that scenario.

You must have seen many "remember me"s just like the one in the figure.


This time I'm gonna share some insights of remembering the user after he leaves the current session.
But, hey! Do you like Cookies ? Well, I know that's an ambiguous question. Anyway we're going to prepare some Cookies and coffee. Nice combination, right? Actually coffee helps me to create Cookies, mentally.
One insane thing here is no one else will be able to taste your Cookies, but you. And that's a necessary thing for adding security to your system.
Let's start overflowing from the Stack
I noticed this discussion on Stackoverflow, which essentially gives you some kind of... i don know... pleasure!? But there is a possibility of leakage, I think. That…

A tiny update from Bangalore

Specifying Paths in Express.js

Hey whassup! This time I'd like to resolve a mess I faced during coding.

There is a function called sendFile() in node. In use cases, it becomes res.sendFile(path_to_file). Specifying file path for res.sendFile() from other directories is a bit tricky!

We have to either use absolute path or specify root for the file location.

( Here is a good article about specifying paths in JavaScript : natashabanegas.com. But unfortunately this is not the solution in our case! ) 

In Express.js most of our works are concentrated on the routes directory, which enables modular coding. So specifying paths for res.sendFile() from routes is not as traditional as in the above linked article, but still simple.

There are two simple ways to do it:

res.sendFile(path.join(__dirname, '../our_directory', 'our_file.html'));res.sendFile('our_file.html', { root: path.join(__dirname, '../our_dir') }); The __dirname returns the directory that the currently executing script is in. So…

One cannot judge the backend complexity by looking at the frontend.

I've seen people saying "this one is pretty easy to implement" by looking at the frontends of some awesome applications. Making frontend and user interface clean and KISS (keep it simple and stupid) is essential for an application to win the users. By that it never meant that it was easy. To make an app more user-friendly, developers has to write extra code to balance the "things" that they have abstracted.

For an instance, consider www.google.com page. How simple and stupid that page is...
6 large letters and a text box. What else in it?! By that would you conclude Google is easy?

I do also have personal experience from a guy, who comments after evaluating our project of 5000 LOC that "is it only this much to do that? Child's play". He also suggested a new feature to add, which was a nice one. On the implementation phase of that feature, we pulled him to find a bug. And after spending 30 mins on our code his reaction - "Someone's callin…

Need a browser? Go for Chrome

Yesterday one of my friends asked me to compare browsers on PC.

I found Google Chrome's JS engine is more powerful than any other browser.
The 64bit-Chrome + 64bit-OS combination is an awesome experience (with a good internet connectivity).
Firefox is a nice browser. And Firefox Dev Edition is good for development. But Chrome is extraordinary, perfect for everything.

Unfortunately Kaspersky Internet Security sometimes block the the entire Firefox experience, which is a dark mark on both Kaspersky and Mozilla.

Safari and Edge are OK. But I can't prefer them over Chrome and Firefox.
I heard that Opera is nice for less data consumption (?)