Skip to content

Instantly share code, notes, and snippets.

View Sampath-Lokuge's full-sized avatar
🏠
Working from home

Sampath Lokuge Sampath-Lokuge

🏠
Working from home
View GitHub Profile
@Sampath-Lokuge
Sampath-Lokuge / gallery.component.ts
Created June 19, 2018 10:47
gallery.component.ts
@Sampath-Lokuge
Sampath-Lokuge / gallery.component.html
Created June 19, 2018 10:44
gallery.component.html
@Sampath-Lokuge
Sampath-Lokuge / gallery.component.css
Last active June 19, 2018 11:17
gallery.component.css
@Sampath-Lokuge
Sampath-Lokuge / HammerJs
Last active June 16, 2018 09:08
HammerJs
import { Directive, ElementRef, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output } from '@angular/core';
interface HammerManager {
new (element: HTMLElement | SVGElement, options?: any): HammerManager;
destroy(): void;
add(recognizer: Recognizer): void;
on(eventName: string, callback: Function): void;
}
interface Recognizer {
//take Photo
takePhoto(sourceType: number) {
const options: CameraOptions = {
quality: 50,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
correctOrientation: true,
sourceType: sourceType,
}
//schedule Notification
async scheduleNotification(data: Transaction) {
let notifications: Notification[] = [];
notifications = await this.storage.get(LocalStorage.NOTIFICATIONS);
let firstNotificationTime = new Date(data.dueOn);
firstNotificationTime.setDate(firstNotificationTime.getDate());
firstNotificationTime.setHours(21);
firstNotificationTime.setMinutes(23);
firstNotificationTime.setSeconds(0);
const id = random(1, 1000);
async scheduleNotification(data: Transaction) {
let notifications: any[] = [];
notifications = await this.storage.get(LocalStorage.NOTIFICATIONS);
let firstNotificationTime = new Date(data.dueOn);
firstNotificationTime.setDate(firstNotificationTime.getDate());
firstNotificationTime.setHours(20);
firstNotificationTime.setMinutes(23);
firstNotificationTime.setSeconds(0);
const id = random(1, 1000);
let notification = {
Token
@Sampath-Lokuge
Sampath-Lokuge / Photo
Created November 1, 2017 04:34
Photo
Photo