Installing NODE, NPM , angular

Use Current Release: At te last update of this tutorial, Node.js 10.0.0 is the current Node.js release available. sudo apt-get install curl python-software-properties curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash – Use LTS Release : At the last update of this tutorial, Node.js 8.11.1 is the LTS release available. sudo apt-get install curl python-software-properties curl -sL https://deb.nodesource.com/setup_8.x …

Angular 2 directive to append HTML in directive selector

Angular 2 directive to append HTML in directive selector. I was trying creating a star rating directive for angular 5 project. It was really hard search for me to insert HTML in to directive selector. I know an component can easily allows access to append HTML inside the element. But i needed to do this …

Add to compare service for observable array of objects for products

Add to compare service for observable array of objects for products. import { Injectable } from ‘@angular/core’; import { BehaviorSubject } from ‘rxjs/BehaviorSubject’; @Injectable() export class SharedService { compareProducts:Array<Product> = []; private compareSource = new BehaviorSubject<Product[]>([]); currentCompare = this.compareSource.asObservable(); constructor() { } addToCompare(productModel){ var index = this.compareProducts.findIndex(item => item.id === productModel.id); if(index > -1){ this.compareProducts.splice(index,1); …

Convert UTC time to most recent text using moment property local and fromNow

How to get recent local time post date from a post stored in UTC date format. moment(this.post.created_at,’YYYY-MM-DD H:m:s’).utc(‘YYYY-MM-DD H:m:s’).local().fromNow() Here is the basic funda you need to follow my current post time stored in this.post.created_at i am converting it into moment using moment.js moment(this.post.created_at,’YYYY-MM-DD H:m:s’) Now we need to get the UTC format of it …

Two months calander code

Two months calender code <!DOCTYPE html> <html> <head> <style> #divCalendar table{float:left;} </style> <title>Simple Month Calendar</title> <script type=”text/javascript”> // Author: Alê Monteiro // Created: 2013-03-06 // E-mail: lu.ale.monteiro@gmail.com // P.S. I’m from Brazil, so the names of the weeks and months are in Portuguese. var Calendar = function(divId) { //Store div id this.divId = divId; // …

stopping a function if called within 5 sec again in typescript or javascrit

stopping a function if called within 5 sec again in typescript or javascrit stopContent = false; getFeed(){ if(this.stopContent == false){ /* stop more on next click */ this.stopContent = true; /* allow more feeds after 5 sec */ setTimeout(e=>{ this.stopContent = false;}, 5000); console.log(‘feeding’); /* your code here */ }else{ console.log(‘stopping’); } }    

Best way to remove index object from the array of object

Best way to remove index object from the array of object. var apps = [{id:34,name:’My App’,another:’thing’},{id:37,name:’My New App’,another:’things’}]; // get index of object with id:37 var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37); // remove object apps.splice(removeIndex, 1);      

Accessing cloud.google.com bitnami project files from ubuntu

Accessing cloud.google.com bitnami project files from ubuntu Site address http://IPADDRESS/ Admin user: user Admin password (Temporary) : PASSWORD   How to generate a SSH key in your PC ? ssh-keygen (see the path for generating key file enter the key filename “/home/shakalya/.ssh/id_rsa”) dff-ssh-key (if same key file name wanna override?) y (passphrase can be leave empty) (again) cat dff-ssh-key …