callback

Unlike many other programming languages, JavaScript enables you to freely pass functions around to be executed at a later time. A callback is a function that is passed as an argument to another function and is executed after its parent function has completed. Callbacks are special because they patiently wait to execute until their parent finishes. Meanwhile, the browser can be executing other functions or doing all sorts of other work.
A definition taken from jquery website

Reference: Michael Vollmer

One should also understand about callback hell

how to minify multiple javascript files using yuicompressor node module

prerequisites

  1. install node js and npm
  2. install yuicompressor using the command npm install yuicompressor

A short tutorial on, how to use yuicompressor is available on https://www.npmjs.com/package/yuicompressor

Here is a small javascript program which helps you to compress multiple files. Continue reading how to minify multiple javascript files using yuicompressor node module

conversion of px to em, % and pt

JSFIDDLE: http://jsfiddle.net/jnelsonin/ctfy158o/

This simple formula will help you to convert a px value in CSS to corresponding em, % and pt.

consider we have a pixel value of 8. Based on the above formula,

pt = (8 * 3) / 4 = 6pt

em = 8 / 12 = 0.5em

% = 0.5 * 100 = 50%

Dos and Don’ts for Blood Donation

You can donate blood if

  • you are between age group of 18-60 years
  • your weight is 45 kgs or more
  • your hemoglobin is 12.5 gm% minimum
  • Your last blood donation was 3 months earlier
  • you are healthy and have not suffered from malaria, typhoid or other transmissible disease in the recent past
  • you have eaten a low fat healthy diet few hours before donating blood

Do not donate blood if you have any of the following conditions: Continue reading Dos and Don’ts for Blood Donation

how to remove the blue highlighting from select element in internet explorer

In Interner Explorer, When we bring the focus to a select element, the element gets highlighted with a blue background, like in this given image. This is the default bahavior of Internet Explorer browser to indicate that, the focus is on select element.

focus-select-ie

How can we remove this highlighting?

Pure CSS method

 jQuery method

 

How to remove the arrow image from select element in FireFox and Internet Explorer

JSFiddle: http://jsfiddle.net/jnelsonin/NMq75/

This is how the select element looks in FireFox and Internet Explorer 10, after giving a background image.

select element in FireFox
select element in FireFox
select element in Internet Explorer 10
select element in Internet Explorer 10

Continue reading How to remove the arrow image from select element in FireFox and Internet Explorer

Two reasons why I uninstalled facebook application and Facebook messenger from my mobile

Reason 1

Facebook recently pushed an update of their application, which requires a lot of additional permissions.

I tried to upgrade facebook application on my mobile, and got worried to see the permissions they are asking to run this application.

Take a look at this picture. I took 4 screenshots and combined together to get a single image.

Have a closer look at the permissions which is marked in red. Continue reading Two reasons why I uninstalled facebook application and Facebook messenger from my mobile

Set multiple css style properties in Javascript

In three different methods you can set multiple style properties to an element using javascript.

for example, consider, you want to apply colour, border colour and visiblity to an element with id myElement

Method 1

Method 2

Now, the above step is going to replace the existing inline style. If you want to keep existing inline style and add these styles additionally, here is the trick

Method 3