Skip to content

Instantly share code, notes, and snippets.

Avatar
🤹‍♂️
hardly working

Jeff Delaney codediodeio

🤹‍♂️
hardly working
View GitHub Profile
View functional-approach.ts
const firestore = firebase.firestore()
const doc$ = (path: string) => {
return Observable.create(observer => {
firestore
.doc(path)
.onSnapshot({
View app.state.ts
@State<AppStateModel>({
name: 'app',
defaults: {
hello: '',
}
})
export class AppState {}
@codediodeio
codediodeio / index.js
Created Sep 13, 2017
Integrate Twilio with Firebase Cloud Functions
View index.js
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 / reverse-int.js
Created Sep 4, 2017
Reverse integer and determine overflow in JavaScript - LeetCode solution
View reverse-int.js
/**
* @param {number} x
* @return {number}
*/
var reverse = function(x) {
let a = x.toString().split('')
let num;
if(a[0] == '-') {
let c = a.shift()
num = parseInt(c +a.reverse().join(''))
@codediodeio
codediodeio / longest-substring.js
Created Sep 4, 2017
Longest Substring JavaScript - LeetCode Solution
View longest-substring.js
// Given a string, find the length of the longest substring without repeating characters.
// Examples:
// Given "abcabcbb", the answer is "abc", which the length is 3.
// Given "bbbbb", the answer is "b", with the length of 1.
// Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring.
@codediodeio
codediodeio / movie.service.ts
Last active Aug 9, 2019
Infinite scroll solution for Firebase + Angular4 (work in progress)
View movie.service.ts
// Movies in Database
//
// movies
// movieKey
// title
// image
// year
import { Injectable } from '@angular/core';
@codediodeio
codediodeio / content-box.component.html
Created Aug 5, 2017
Animate a div based on scroll position Angular 4.3
View content-box.component.html
<div class="box" [@scrollAnimation]="state">
<img src="https://images.pexels.com/photos/37547/suit-business-man-business-man-37547.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb">
</div>
@codediodeio
codediodeio / geo-json.ts
Last active Nov 10, 2020
A Typescript interface for GeoJSON objects based on rfc7946
View geo-json.ts
export interface IGeometry {
type: string;
coordinates: number[];
}
export interface IGeoJson {
type: string;
geometry: IGeometry;
bbox?: number[];
properties?: any;
@codediodeio
codediodeio / example.ts
Last active Jul 26, 2017
Composite Key Pattern in Firebase
View example.ts
createData() {
const data = {
name: 'Crane',
family: 'bird',
weight: 10,
endangered: false,
// composite keys
endangered_family: 'false_bird',
@codediodeio
codediodeio / search-ui.html
Last active Jul 27, 2017
Custom InstantSearchJS template with Angular bindings
View search-ui.html
<div *ngFor="let hit of hits | async">
{{hit | json}}
</div>