Skip to content

Instantly share code, notes, and snippets.

View codediodeio's full-sized avatar
🤹‍♂️
hardly working

Jeff Delaney codediodeio

🤹‍♂️
hardly working
View GitHub Profile
@codediodeio
codediodeio / config.js
Last active November 17, 2024 09:51
Snippets from the Firestore Data Modeling Course
import * as firebase from 'firebase/app';
import 'firebase/firestore';
var firebaseConfig = {
// your firebase credentials
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
@codediodeio
codediodeio / database.rules.json
Last active November 4, 2024 03:22
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@codediodeio
codediodeio / print.js
Last active February 9, 2024 14:11
print
export const print = (v) => {
const el = document.createElement('h3');
el.innerText = '🔵 ' + v;
document.body.appendChild(el);
}
@codediodeio
codediodeio / emoji.js
Last active December 13, 2023 15:07
Just a string filled with Emojis
export const emojis =
'😀,😃,😄,😁,😆,😅,😂,🤣,😊,🙂,🙃,😉,😌,😍,😘,😗,😙,😚,😋,😛,😝,😜,🤪,🤨,🧐,🤓,😎,🤩,😏,😒,😞,😔,😟,😕,🙁,😣,😖,😫,😩,😢,😭,😤,😠,😡,🤬,🤯,😳,😱,😨,😰,😥,😓,🤗,🤔,🤭,🤫,🤥,😶,😐,😑,😬,🙄,😯,😦,😧,😮,😲,😴,🤤,😪,😵,🤐,🤢,🤮,🤧,😷,🤒,🤕,🤑,🤠,😈,👿,👹,👺,🤡,💩,👻,💀,👽,👾,🤖,🎃,😺,😸,😹,😻,😼,😽,🙀,😿,😾,🤲,👐,🙌,👏,🤝,👍,👎,👊,✊,🤛,🤞,🤟,🤘,👌,👉,👈,👆,👇,✋,🤚,🖐,🖖,👋,🤙,💪,🖕,🙏';
export const emojisArray = emojis.split(',');
export const emojiRandom = () =>
emojisArray[Math.floor(Math.random() * emojisArray.length)];
@codediodeio
codediodeio / index.js
Created September 13, 2017 00:21
Integrate Twilio with Firebase Cloud Functions
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const twilio = require('twilio');
const accountSid = functions.config().twilio.sid
const authToken = functions.config().twilio.token
const client = new twilio(accountSid, authToken);
@codediodeio
codediodeio / auth.service.ts
Created May 8, 2017 16:41
Angular4 Firebase authentication service using OAuth, Anonymous, and Email/Password. Designed specifically for changes introduced in AngularFire2 4.0.0
import { Injectable } from '@angular/core';
import { AngularFireDatabaseModule, AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
import { Router } from "@angular/router";
import * as firebase from 'firebase';
@Injectable()
export class AuthService {
@codediodeio
codediodeio / geo-json.ts
Last active November 9, 2021 12:54
A Typescript interface for GeoJSON objects based on rfc7946
export interface IGeometry {
type: string;
coordinates: number[];
}
export interface IGeoJson {
type: string;
geometry: IGeometry;
bbox?: number[];
properties?: any;
@codediodeio
codediodeio / index.js
Created June 28, 2017 15:54
Firebase Cloud Functions image thumbnail generator using Sharp for 4x faster resizing
const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')();
const sharp = require('sharp')
const _ = require('lodash');
const path = require('path');
const os = require('os');
exports.generateThumbnail = functions.storage.object('uploads/{imageId}').onChange(event => {
const object = event.data; // The Storage object.
@codediodeio
codediodeio / functional-approach.ts
Last active October 4, 2021 04:55
rxfire Ideas
const firestore = firebase.firestore()
const doc$ = (path: string) => {
return Observable.create(observer => {
firestore
.doc(path)
.onSnapshot({
@codediodeio
codediodeio / phone-login.component.html
Last active July 12, 2021 20:09
Firebase Phone Login Angular 4
<div [hidden]="user">
<h1>Sign In with Your Phone Number</h1>
<label for="phone">Phone Number</label><br>
<input type="text" [(ngModel)]="phoneNumber.country" class="input" placeholder="1" maxlength="2">
<input type="text" [(ngModel)]="phoneNumber.area" class="input" placeholder="949" maxlength="3">
<input type="text" [(ngModel)]="phoneNumber.prefix" class="input" placeholder="555" maxlength="3">
<input type="text" [(ngModel)]="phoneNumber.line" class="input" placeholder="5555" maxlength="4">