Skip to content

Instantly share code, notes, and snippets.

View leifwells's full-sized avatar

Leif Wells leifwells

View GitHub Profile
@leifwells
leifwells / .angular-cli.json
Last active March 31, 2018 22:42
Setting Up Testing in Ionic 3
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "ng-test-project"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
@leifwells
leifwells / page1.e2e-spec.ts
Created September 2, 2017 16:31
Starter End-to-end Test for a Page of an Ionic Project
import { Page } from './app.po';
describe('App', () => {
let page: Page;
beforeEach(() => {
page = new Page();
});
describe('default screen', () => {
@leifwells
leifwells / app.component.spec.ts
Created September 2, 2017 16:23
Starter unit test for app.component.ts for an Ionic project
import { async, TestBed } from '@angular/core/testing';
import { IonicModule, Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { MyApp } from './app.component';
import {
PlatformMock,
StatusBarMock,
@leifwells
leifwells / mocks-ionic.ts
Created March 31, 2017 23:48
Mock objects for use when unit testing applications built with Ionic
import { NgZone, Renderer } from '@angular/core';
export class ConfigMock {
public get(): any {
return '';
}
public getBoolean(): boolean {
return true;
@leifwells
leifwells / home.ts
Last active June 9, 2016 18:46
The Component Calling Our Google Drive Provider
import { Component } from "@angular/core";
import { GoogleDriveProvider } from './../../providers/google-drive/google-drive';
@Component({
templateUrl: 'build/pages/home/home.html',
providers: [ GoogleDriveProvider ]
})
export class HomePage {
persons: Array<any>;
dataId: string;
@leifwells
leifwells / google-drive.ts
Last active December 29, 2018 05:35
Example Ionic 2/Angular 2 Provider for a Google spread sheet
import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
import 'rxjs/add/operator/map';
/*
Generated class for the GoogleDrive provider.
See https://angular.io/docs/ts/latest/guide/dependency-injection.html
for more info on providers and Angular 2 DI.
*/
LocalNotifications.schedule( {
id: 1, // Number, used as unique identifier
title: 'Sample Local Notification', // String, 1st row of notification
text: 'This is a sample local notification.', // String,
// 2nd row of the notification
/* WARNING: USING THE DEFAULT SOUND
'res://platform_default'
DOES NOT PLAY SOUND IN THE EMULATOR */
sound: 'file://audio/notification.wav', // Uri, path to sound file
/* TIME SET TO TEN SECONDS
@leifwells
leifwells / Ionic 1 Local Notification with Sound.js
Last active June 4, 2016 14:49
Ionic 1: Setting a Local Notification with Sound
$cordovaLocalNotification.schedule({
id: note.id, // Number, used as unique identifier
at: note.at, // Date or Number, time
text: note.text, // String, 1st row of notification
title: note.title, // String, 2nd row of the notification
sound: 'res://platform_default',// Uri, path to sound file
badge: 1, // Number, appear on app icon
data: 'hello=world' // String, objects as encoded JSON
}).then(function ( result ) {
console.log(note.title + ' Notification Set');
https://api.iontelevision.com/1.1/gigya-login?username=owPbHTpDWFI%2B47bkOJLn5MK0TcrcaeXe53rLStbY0ObaWyVA&password=zAN1dTpDWFLP%2B9Z4kSD%2FmMKiYQY%3D&apikey=API_KEY&secret=SECRET_KEY