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
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
<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
// 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
// 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
let option = {} | |
if (locale) { | |
let token = await firebase.auth().currentUser?.getIdToken() | |
option = { | |
params: { yourParam: valueOfParam }, | |
headers: { | |
Authorization: `Bearer ${token}` | |
} | |
} | |
} |
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
// Without params and return type | |
let closureFunc = { | |
print("Printed from a closure") | |
} | |
closureFunc() // Printed from a closure | |
// With a parameter | |
let closureWithParams = { (name:String) in | |
print("My name is \(name)") | |
} |
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
import UIKit | |
class PreferencesViewController: UIViewController { | |
@IBOutlet var usernameLabel: UILabel! | |
@IBOutlet var profilePic: UIImageView! | |
@IBOutlet var profileBox: UIView! | |
@IBOutlet var signOutButton: UIButton! | |
@IBOutlet var learningLanguageTextField: UITextField! | |
@IBOutlet var translationTextField: UITextField! |
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
import SwiftUI | |
import Firebase | |
@main | |
struct SpeechApp: App { | |
@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate | |
var body: some Scene { | |
WindowGroup { |
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 origData = [ | |
{ | |
uid:123123, | |
displayName: "user1", | |
email: null, | |
emailVerified: false, | |
isAnonymous: false, | |
photoURL: "http://gooooooo.com/123123jiji", | |
nestedData: { |