How to add highchart in angular 5

Highchart is an popular libary to implement charts in your application. Highcharts comes with both personal and commercial version.

Users can purchase based on needs.

Here the steps to implement in Angular 5 Application.

Step 1:

# install angular-highcharts and highcharts
npm i --save angular-highcharts highcharts

# install highcharts typings
npm i --save-dev @types/highcharts

Step 2:

// app.module.ts
import { ChartModule } from 'angular-highcharts';</code>

@NgModule({
imports: [
ChartModule // add ChartModule to your imports
]
})
export class AppModule {} 

Step 3:


// chart.component.ts
import { Chart } from 'angular-highcharts';

@Component({
  template: `
    <button (click)="add()">Add Point!</button>
    <div [chart]="chart"></div>
  `
})
export class ChartComponent {
  chart = new Chart({
    chart: {
      type: 'line'
    },
    title: {
      text: 'Linechart'
    },
    credits: {
      enabled: false
    },
    series: [
      {
        name: 'Line 1',
        data: [1, 2, 3]
      }
    ]
  });

  // add point to chart serie
  add() {
    this.chart.addPoint(Math.floor(Math.random() * 10));
  }
}

More Information: github.com

Custom templates not showing up in template dropdown in WordPress 4.9

In wordpress there is a bug. When you create new custom template and search in backend dropdown you are not able to view custom template name in WordPress. Needs to wait until clears the bug.

Simple solution below

update below code in functions.php

function wp_42573_fix_template_caching( WP_Screen $current_screen ) {
	// Only flush the file cache with each request to post list table, edit post screen, or theme editor.
	if ( ! in_array( $current_screen->base, array( 'post', 'edit', 'theme-editor' ), true ) ) {
		return;
	}
	$theme = wp_get_theme();
	if ( ! $theme ) {
		return;
	}
	$cache_hash = md5( $theme->get_theme_root() . '/' . $theme->get_stylesheet() );
	$label = sanitize_key( 'files_' . $cache_hash . '-' . $theme->get( 'Version' ) );
	$transient_key = substr( $label, 0, 29 ) . md5( $label );
	delete_transient( $transient_key );
}
add_action( 'current_screen', 'wp_42573_fix_template_caching' );

More Info – https://core.trac.wordpress.org/ticket/42573

How to change port in GIT

When you clone repository from git using SSH you may get following error message

ssh: connect to host github.com port 22: Bad file number 
ssh: connect to host (some host or IP address) port 22: Bad file number

Solution :

Step 1: open gitbash
Step 2: > touch ~/.ssh/config
Step 3: > Paste following code in config file

Host github.com
   User git
   Hostname ssh.github.com
   PreferredAuthentications publickey
   IdentityFile ~/.ssh/id_rsa
   Port 443