Docker file for Express App with PM2

Docker file for Express App with PM2

FROM node:10 WORKDIR /usr/src/app COPY package*.json ./ RUN npm install pm2 -g RUN npm install COPY . . EXPOSE 8080...

Javascript / JQuery Snippets - 6 months ago

Difference between two date in JavaScript

Difference between two date in JavaScript

Let us see an example of how to calculate the difference between dates using Javascript. First, write an HTML code...

Javascript / JQuery Snippets - 6 months ago

Use for() instead Array.forEach(), for() is 95% faster

Use for() instead Array.forEach(), for() is 95% faster

Array.ForEach is about 95% slower than for() in for each for Arrays in JavaScript. So, don't use: var data =...

Javascript / JQuery Snippets - 2 years ago

JavaScript - How to check number is odd or even

JavaScript - How to check number is odd or even

Here is the simple JavaScript code snippet to check if the given number is an odd or even number. Function...

Javascript / JQuery Snippets - 3 years ago

JQuery Preload Images

JQuery Preload Images

jQuery make it easy to preload images in the background so visitors won’t have to wait forever when they would...

Javascript / JQuery Snippets - 4 years ago

Toggle class on hover

Toggle class on hover

$('.btn').hover(function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover'); } );

Javascript / JQuery Snippets - 4 years ago

Fix broken images automatically

Fix broken images automatically

Occasionally we have times when we have broken image links on our website and replacing them one by one isn’t...

Javascript / JQuery Snippets - 4 years ago

Append New HTML

Append New HTML

var sometext = "here is more HTML"; $("p#text1").append(sometext); // added after $("p#text1").prepend(sometext); // added before

Javascript / JQuery Snippets - 4 years ago

Equal Column Heights

Equal Column Heights

var maxheight = 0; $("div.col").each(function(){ if($(this).height() > maxheight) { maxheight = $(this).height(); } }); $("div.col").height(maxheight);

Javascript / JQuery Snippets - 4 years ago

Scroll to Top

Scroll to Top

$("a[href='#top']").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; });

Javascript / JQuery Snippets - 4 years ago