This file contains hidden or 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
// do this before your work needs an authentication | |
if (req.headers.authorization && req.headers.authorization.startsWith('Bearer ')) { | |
console.log('Found "Authorization" header'); | |
// Read the ID Token from the Authorization header. | |
idToken = req.headers.authorization.split('Bearer ')[1] | |
const decodedIdToken = await admin.auth().verifyIdToken(idToken) | |
console.log('ID Token correctly decoded', decodedIdToken) | |
req.user = decodedIdToken | |
}else{ |
This file contains hidden or 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
// This work with assigning by value | |
var i = 3 | |
// 3 | |
j = i | |
// 3 | |
j += 1 | |
// 4 | |
i | |
// 3 | |
j |
This file contains hidden or 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
<ul id="ul-collections"> | |
<li> | |
<template id="collection-row-template"> | |
<div class="border border-gray-500 w-64 rounded-3xl cursor-pointer"> | |
<div class="p-4 text-xl font-bold font-serif">The basic english phrase: Greeting; by author Fred.</div> | |
<div class="p-4"> | |
<span class="font-bold">6</span> | |
<span class="text-xs">phrases for </span> | |
<span class="text-sm italic">Beginner</span> |
This file contains hidden or 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 rowTemplate = document.querySelector<HTMLTemplateElement>('#collection-row-template')! | |
const ul = document.querySelector<HTMLUListElement>('#ul-collections')! | |
const li = document.createElement("li") as HTMLLIElement | |
li.appendChild(rowTemplate.content.cloneNode(true)) | |
ul.append(li) | |
console.log(`append`) |
This file contains hidden or 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
export class UI { | |
toastTemplate?: HTMLTemplateElement | |
constructor(templateSelector: string) { | |
this.toastTemplate = document.querySelector<HTMLTemplateElement>( | |
templateSelector | |
)! | |
} | |
showToast() { |
This file contains hidden or 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
let toast = new toastMessage.UI("#toast-message-template") | |
toast.showToast() |
This file contains hidden or 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
// | |
// Created by Fredric Cliver on 2020/10/13. | |
// | |
import UIKit | |
import Firebase | |
import GoogleSignIn | |
import CryptoKit | |
import AuthenticationServices |
This file contains hidden or 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
@IBAction func onClickSignOut(_ sender: UIButton) { | |
let firebaseAuth = Auth.auth() | |
do { | |
try firebaseAuth.signOut() | |
self.view.window?.rootViewController?.dismiss(animated: true, completion: nil) | |
} catch let signOutError as NSError { | |
print ("Error signing out: \(signOutError.localizedDescription)") | |
} | |
} |
This file contains hidden or 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
export const functionsRegion = () => { | |
if (location.hostname == "127.0.0.1" || location.hostname == "localhost") { | |
return undefined | |
} else { | |
return "europe-west1" | |
} | |
} |