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 {} |
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); |
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('')) |
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. |
View movie.service.ts
// Movies in Database | |
// | |
// movies | |
// movieKey | |
// title | |
// image | |
// year | |
import { Injectable } from '@angular/core'; |
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> |
View geo-json.ts
export interface IGeometry { | |
type: string; | |
coordinates: number[]; | |
} | |
export interface IGeoJson { | |
type: string; | |
geometry: IGeometry; | |
bbox?: number[]; | |
properties?: any; |
View example.ts
createData() { | |
const data = { | |
name: 'Crane', | |
family: 'bird', | |
weight: 10, | |
endangered: false, | |
// composite keys | |
endangered_family: 'false_bird', |
View search-ui.html
<div *ngFor="let hit of hits | async"> | |
{{hit | json}} | |
</div> |