Arrow functions in Javascript

Standard

Let’s meet our buddy called arrow function. What are they?

Arrow functions are short hands for writing a function which doesn’t need a name and works in lexical scopes.

As per mozilla:

An arrow function expression has a shorter syntax compared to function expressions and lexically binds the this value (does not bind its own this, arguments, super, or new.target). Arrow functions are always anonymous. These function expressions are best suited for non-method functions and they can not be used as constructors.

Continue reading

Finding the first day and last day of current month.

Standard

Have you faced a situation when you need to find the first day and last day of a month? Such scenarios occurs when we do some kind of enterprise application when accounting or billing modules comes into the picture.

And YES its important as well. Lets find out in some of the technologies.

#JAVASCRIPT

Sometimes we have to send the dates from front end. Lets say by default you have to set date range components from 1st day of this month to current date. So here is the hack.

Continue reading

Atom Editor packages behind the corporate firewall

Standard

Are you in love with brand new code editor from github team?  Yes it’s atom!

Atom editor is opensource and fully customizable in terms of installing packages and plugins to help us with whether its a debug tool, code snippets or anything else. We have bunch of free packages from the community.

But what about installing these packages behind the firewall? As we are not allowed to access URLs in our offices. So for this purpose we use proxy settings that relaxed us with url access.

Continue reading

Starting with gulp

Standard

Gulp – The streaming build system. As the name say, gulp is a tool for building the system.

In short, a tool which can help with automating the build process. Gulp is a javascript based build tool that uses nodejs as its running environment.

Its a task runner which can help with some very important and frequently used task like JS and CSS minification, compiling SASS etc.

Continue reading

prefetch, preconnect, prerender , All about prebrowsing

Standard

How website/app performance matters to you? What ways you know to improve it? Do you know just minification, concatenation, caching? Do we have other options?

What if you can get ready with your assets just before DOM is ready. What if you can load them in advance? Does it make a difference? Do you care? Big question to ask to our self.

We have some cool techniques to achieve advance or pre loading of our assets.

Continue reading

Merging a git branch keeping some file untouched

Standard

I usually maintain a release branch to upload my code to the stage environment or production. Its very common to have some sort of config files which are related to the targeted environment. For example: database connection files, api URLs etc. And I believe that everyone uses different DB and APIs for dev and prod. Yes we use! 🙂

Now the problem begins when we merge our master branch with release and all of our config files gets overwritten. What the F**K. Its again rework on our end to fix those files to make our code work on that particular environment.

Continue reading

Trick to make your footer sticky at the bottom of the page and stay at the bottom when your content grows.

Standard

What about footers on website which stays below to your content? What if your content is not long enough to fill the whole page? Does your footer not able to stay at the bottom of the page?

Above situation occurs with all of us. Sometimes we want our footer to stick with the bottom and slide down with the content when our content grows. We cant make it absolute and set bottom:0 because at no matter what we don’t want to float over to the content. Its looks YAAK.

Here is a simple trick which can save us. Let’s look at it.

Continue reading

AngularJS directive to non interactive html components

Standard

Using utilities to get work done is always comfortable and good practice for sake of code re usability. Recently I came across a requirement where I had to make my several HTML component non clickable.

You can make input types elements non clickable very easily as disabled attribute works well with input types. But wait! what about other elements? Now a days we have lots of third party UI frameworks as angular-material or bootstrap which provides custom stitched input type like md-checkbox in angular material library.

Continue reading

ng-message validation based on other input field in angularJs

Standard

Recently I faced an requirement where I have to plugin ng-message validation which depends on value of other input field means if value of field A is given then only field B is mandatory. For example, if user is providing phone no then email is not mandatory else email is mandatory.

Yes we can achieve this in a very simple and straight forward way. Lets see how.

Goal: Using ng-messages validation depending upon the value of other field

Continue reading