Skip to content

Instantly share code, notes, and snippets.

@llucasshenrique
llucasshenrique / camera.ts
Last active December 28, 2017 18:45
Firebase storage video
import { AngularFireAuth } from 'angularfire2/auth';
import { FirebaseStorageProvider } from './../firebase-storage/firebase-storage';
import { File } from '@ionic-native/file';
import { FilePath } from '@ionic-native/file-path';
import { FileChooser } from '@ionic-native/file-chooser';
import { Camera, CameraOptions } from '@ionic-native/camera';
import { MediaCapture,
CaptureVideoOptions,
MediaFile,
CaptureError,
// Estrutura do Firebase Database
// {
// "formulario": { // Aqui ficam salvo as entradas que gerarão o grafico
// "formularioID":{
// "uid": "464165dsada",
// "contador1": "dado 1",
// "contador2": "dado 2"
// }
// },
// "grafico": { // Aqui fica salvo os dados para o grafico
@llucasshenrique
llucasshenrique / app.component.ts
Last active October 19, 2017 05:21
Multiple Profiles App
@Component({
templateUrl: 'app.html'
})
export class MyApp {
public activeProfile: Profile;
constructor(
private afAuth: AngularFireAuth,
private profileProvider: ProfileProvider,
) {
afAuth.auth.onAuthStateChanged( user => {
import { Injectable } from '@angular/core';
import { Pipe } from '@angular/core';
import { File } from '@ionic-native/file';
import { Network } from '@ionic-native/network';
import { LocalNotifications } from '@ionic-native/local-notifications';
import { AngularFireAuth } from 'angularfire2/auth';
import { LoadingController } from 'ionic-angular';
import * as firebase from 'firebase';
import { Observable } from "rxjs/Observable";
import { Observer } from "rxjs/Observer";
/**
*
* Os cheboxes são gerados dinamimcamente a partir do array customTypes
* Exemplo do HTML responsável pelo Checkbox
*/
`
<ion-item *ngFor="let customType of customTypes" (press)="editCustomType(customType)" >
<ion-label>{{customType?.name}}</ion-label>
<ion-label>{{customType?.description}}</ion-label>
<ion-checkbox color="customType?.color" (ionChange)="addType(customType)" [checked]="isChecked(customType)"></ion-checkbox>
export class Report {
values: ReportValues
metadata: ReportMetadata
media: string[]
}
class ReportMetadata {
//Esses timestamp é um objeto mas considere ele apenas como uma data
createdServerTime? = firebase.firestore.FieldValue.serverTimestamp()
lastUpdateServerTime? = firebase.firestore.FieldValue.serverTimestamp()
createdLocalTime: string
import * as moment from 'moment';
import { Injectable } from '@angular/core';
import { isArray } from 'ionic-angular/util/util';
import { ReplaySubject, Observable } from 'rxjs';
import { ChartData, ChartDataSets } from 'chart.js';
import { Profile } from './../../models/profile/profile';
import { Report } from './../../models/report/report';
import { ReportProvider } from './../report/report';
import { ProfileProvider } from './../profile/profile';
// Dados que veem do Database
const dados = [
{
values: {
date: '2018-02-01',
id: '1351316',
triggers: [{
id: '02125',
name: 'nome do tringger01',
<?php
$date1 = new DateTime('Mon, 15 Aug 05 15:52:01 +0000');
$date2 = new DateTime('Mon, 15 Aug 05 09:52:01 +0000');
$date3 = new DateTime('Mon, 15 Aug 05 10:32:01 +0000');
$paraSerOrdenado = [
'array1' => [
'datareal' => $date1,
'datastr' => $date1->getTimestamp(), //timestamp é int
],
const images = [
{
file: '00.txt',
source: '00'
},
{
file: '01.txt',
source: '01'
},
{