This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import * as firebase from 'firebase'; | |
//...omitted | |
@Injectable() | |
export class AuthService { | |
resetPassword(email: string) { | |
var auth = firebase.auth(); | |
return auth.sendPasswordResetEmail(email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var functions = require('firebase-functions'); | |
const sendgrid = require('sendgrid') | |
const client = sendgrid("YOUR_SG_API_KEY") | |
function parseBody(body) { | |
var helper = sendgrid.mail; | |
var fromEmail = new helper.Email(body.from); | |
var toEmail = new helper.Email(body.to); | |
var subject = body.subject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
Stream<bool> interval = | |
Stream.periodic(Duration(seconds: 1), (i) => (i % 2 == 0)) | |
.asBroadcastStream(); | |
class Blink extends StatelessWidget { | |
String text; | |
Blink({Key key, this.text}) : super(key: key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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('')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; | |
import { Observable } from 'rxjs/Observable'; | |
import { AngularFireAuth } from 'angularfire2/auth'; | |
import 'rxjs/add/operator/do'; | |
import 'rxjs/add/operator/map'; | |
import 'rxjs/add/operator/take'; | |
@Injectable() | |
export class AuthGuard implements CanActivate { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions') | |
const admin = require('firebase-admin') | |
admin.initializeApp(functions.config().firebase); | |
const stripe = require('stripe')(functions.config().stripe.testkey) | |
exports.stripeCharge = functions.database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const admin = require("firebase-admin"); | |
admin.initializeApp(functions.config().firebase); | |
const algoliasearch = require('algoliasearch'); | |
const algolia = algoliasearch(functions.config().algolia.appid, functions.config().algolia.adminkey); | |
exports.updateIndex = functions.database.ref('/books/{bookId}').onWrite(event => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { AngularFireAuth, AngularFireDatabase, FirebaseAuthState, AuthProviders, AuthMethods, AngularFire } from "angularfire2"; | |
import { Router } from "@angular/router"; | |
import * as firebase from 'firebase'; | |
@Injectable() | |
export class AuthService { |