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 CMD ["pm2-runtime", "server.js"]
FROM node:10 WORKDIR /usr/src/app COPY package*.json ./ RUN npm install pm2 -g RUN npm install COPY . . EXPOSE 8080 CMD ["pm2-runtime", "server.js"]
Let us see an example of how to calculate the difference between dates using Javascript. First, write an HTML code with Javascript as below: const
Array.ForEach is about 95% slower than for() in for each for Arrays in JavaScript. So, don’t use: var data = []; arr.forEach(function (item) { data.push(item);
Here is the simple JavaScript code snippet to check if the given number is an odd or even number. Function to check Number Is Odd
jQuery make it easy to preload images in the background so visitors won’t have to wait forever when they would like to display an image.
$('.btn').hover(function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover'); } );
Occasionally we have times when we have broken image links on our website and replacing them one by one isn’t easy, so adding this simple
var sometext = "here is more HTML"; $("p#text1").append(sometext); // added after $("p#text1").prepend(sometext); // added before
var maxheight = 0; $("div.col").each(function(){ if($(this).height() > maxheight) { maxheight = $(this).height(); } }); $("div.col").height(maxheight);
$("a[href='#top']").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; });