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
@shafiqshams
shafiqshams / crud.component.ts
Created February 22, 2018 20:33
CRUD with HTTP Methods
import { Component } from '@angular/core';
import { DataService } from '../../services/data.service';
@Component({
selector:'sandbox',
template:`
<h1>Hello World</h1>
<form (submit)="onSubmit(isEdit)">
<div class="form-group">
<label>Name</label>
@shafiqshams
shafiqshams / keyboard.component.ts
Created February 22, 2018 20:22
Keyboard Events Ionic 2
import { Component } from '@angular/core';
@Component({
selector:'sandbox',
template:`
<h1>Hello World</h1>
<div>
<input type="text" (keyup)="fireEvent($event)" placeholder="keyup event">
</div>
<div>
@shafiqshams
shafiqshams / mouse.component.ts
Created February 22, 2018 20:18
Mouse Events Ionic 2
import { Component } from '@angular/core';
@Component({
selector:'sandbox',
template:`
<h1>Hello World</h1>
<button id="btn" (click)="fireEvent($event)">Click Event</button>
<br>
<button id="btn" (mouseover)="fireEvent($event)">Mouseover Event</button>
<br>
@shafiqshams
shafiqshams / validation.component.ts
Last active February 22, 2018 20:13
Sandbox Component for Template Driven Forms Validation
import { Component } from '@angular/core';
@Component({
selector:'sandbox',
template:`
<h1>Hello World</h1>
<form novalidate #f="ngForm" (ngSubmit)="onSubmit(f)">
<div class="form-group">
<label>Name</label>
<input
@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')) {
@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 / 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 / index.android.js
Created April 17, 2017 10:11
Index FILE used for android and ios both.
import { AppRegistry } from 'react-native';
import App from './src/app';
AppRegistry.registerComponent('LoginApp', () => App);
@shafiqshams
shafiqshams / app.js
Created April 17, 2017 10:10
BoilerPlate for App.JS (ReactNative)
import React, { Component } from 'react';
import { Text, View } from 'react-native';
class App extends Component {
render() {
return (
<View>
<Text>An App!</Text>
</View>
);
@shafiqshams
shafiqshams / AlbumList.js
Created April 11, 2017 08:59
Refactored to Class Based Component.
import React, { Component } from 'react';
import { Text, View } from 'react-native';
class AlbumList extends Component {
render() {
return (
<View>
<Text> AlbumList!!! </Text>
</View>
);