Skip to content

Instantly share code, notes, and snippets.

View shafiqshams's full-sized avatar
🏠
Working from home

Shafiq Shams shafiqshams

🏠
Working from home
View GitHub Profile
/* Deleting a node from Binary search tree */
#include<iostream>
using namespace std;
struct Node {
int data;
struct Node *left;
struct Node *right;
};
//Function to find minimum in a tree.
Node* FindMin(Node* root)
public class minHeap {
public int size;
public int [] mH;
public int position;
public minHeap(int size){
this.size=size;
mH = new int [size+1];
position = 0;
}
public void createHeap(int [] arrA){
@shafiqshams
shafiqshams / app.component.ts
Created August 8, 2017 19:22
Redirect the user to main page if it's not authenticated, works even after logout. - [Angular 2 & Firebase App [Part 4] - Firebase Authentication]
import { Component, OnInit } from '@angular/core';
import { AngularFireAuth } from 'angularfire2';
import { Router } from '@angular/router';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
@shafiqshams
shafiqshams / listings.component.ts
Created August 8, 2017 19:22
To avoid shows console error if the user is not authenticated to get listings from Firebase. [Angular 2 & Firebase App [Part 4] - Firebase Authentication]
import { Component, OnInit } from '@angular/core';
import { FirebaseService } from '../../services/firebase.service';
@Component({
selector: 'app-listings',
templateUrl: './listings.component.html',
styleUrls: ['./listings.component.css']
})
export class ListingsComponent implements OnInit {
@shafiqshams
shafiqshams / location.ts
Created November 22, 2017 15:06 — forked from schmidt1024/location.ts
start external map navigation from ionic 2 app for ios and android; needs cordova-plugin-geolocation
startExternalMap() {
if (this.location.latitude) {
this.platform.ready().then(() => {
Geolocation.getCurrentPosition().then((position) => {
// ios
if (this.platform.is('ios')) {
window.open('maps://?q=' + this.location.name + '&saddr=' + position.coords.latitude + ',' + position.coords.longitude + '&daddr=' + this.location.latitude + ',' + this.location.longitude, '_system');
};
// android
if (this.platform.is('android')) {