Skip to content

Instantly share code, notes, and snippets.

View pramodmg's full-sized avatar
👉
Front End Dev, #reactjs, react, #javascript

Pramod M G pramodmg

👉
Front End Dev, #reactjs, react, #javascript
  • Bangalore,Karnataka
View GitHub Profile
@pramodmg
pramodmg / ImageRotation.html
Created August 5, 2021 20:28
Problem Statement: Write a Program to display an image after a defined set of time, using Promise where you will set the timeOut of the Image.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sample Program to Render Image after a defined Time</title>
</head>
<body>
<h1>Render Image after a defined Time</h1>
@pramodmg
pramodmg / package.json
Created August 1, 2021 19:33
Setting up the express web server - simplest way
{
"name": "express-web-server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node simpleRoute.js"
},
"keywords": [],
@pramodmg
pramodmg / MemCache.js
Last active December 11, 2018 18:20
Implementation of the memory Cache using the javascript.
/*
using the memCache using the javascript
1. we are implementing to reduce the response time, no other data space is being used.
2. Better approach to solve most of the clientside optimizaition.
*/
function memCache(func){
var cache = {};
return function(){
var key = JSON.stringify(arguments);
@pramodmg
pramodmg / simple.js
Created December 5, 2017 06:44
Replacing an array with an index values of the String
// es6 syntax
var arr = ["a","b","c"];
var str = "Hello {1} is a friend of {2} and {3}";
var result_es6 = arr.reduce((str_data, replacement, idx) => {
return str_data.replace(`{${idx + 1}}`, replacement)
}, str);
console.log(result_es6); // "Hello a is a friend of b and c"
@pramodmg
pramodmg / app.js
Created July 28, 2017 06:44
A simple Gulp + browser-sync + express
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
var port = 5001;
app.use(express.static('public'));
app.get('/', function (req, res) {