Skip to content

Instantly share code, notes, and snippets.

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

Evelyn Mendes evlymn

🏠
Working from home
View GitHub Profile
@evlymn
evlymn / firestore.service.ts
Last active August 29, 2023 19:29
Firestore Basics, Modular Firebase 9
import { Injectable } from '@angular/core';
import { Firestore, collectionData, collection, QueryConstraint } from '@angular/fire/firestore';
import { addDoc, CollectionReference, deleteDoc, doc, getDoc, query, setDoc, updateDoc } from '@firebase/firestore';
import { enableIndexedDbPersistence } from 'firebase/firestore';
@Injectable({
providedIn: 'root'
})
export class FirestoreService {
@evlymn
evlymn / authentication.service.ts
Last active October 20, 2022 07:03
Authentication Service Modular Firebase 9
import { Injectable, NgZone } from '@angular/core';
import {
Auth, signOut, user, signInWithEmailAndPassword, createUserWithEmailAndPassword,
updateProfile, sendEmailVerification, sendPasswordResetEmail, User, authState, onAuthStateChanged,
ActionCodeSettings
// getAdditionalUserInfo,
// OAuthProvider,
// linkWithPopup,
// unlink,
// updateEmail,
@evlymn
evlymn / storage.service.ts
Last active April 12, 2023 14:44
Storage Service Modular Firebase 9
import {Injectable} from '@angular/core';
import {
deleteObject,
getDownloadURL,
percentage,
ref,
Storage,
StringFormat,
uploadBytes,
uploadBytesResumable,
<html>
<head>
<style>
html,
body {
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
@evlymn
evlymn / install-remove-firebase-tools-with-curl.txt
Created June 19, 2022 16:15
install and remove firebase-tools with curl
curl -sL firebase.tools | upgrade=true bash
curl -sL firebase.tools | uninstall=true bash
@evlymn
evlymn / cleanString-hashcode.ts
Last active September 10, 2022 03:39
Clean String and Hash Code Typescript
cleanString = (str: string) => str.replace(/[^\w ]/g, '').replace(/\s/g, '');
hash = (str: string) => str.split('').reduce((prev, curr) => (((prev << 5) - prev) + curr.charCodeAt(0)) | 0, 0);
@evlymn
evlymn / emulators-persist-data.sh
Created October 24, 2022 13:28
Firebase Emulators Persist Data
firebase emulators:start --import=./emulators-data --export-on-exit