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
func combineAsyncCalls(completionHandler: @escaping (String)->()) { | |
var text = "" | |
fetchData(0, delay: 0.4) { text += $0 } | |
fetchData(1, delay: 0.2) { text += $0 } | |
completionHandler(text) | |
} | |
combineAsyncCalls() { | |
print($0) |
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
func combineAsyncCallsWithDispatchGroup(completionHandler: @escaping (String)->()) { | |
let group = DispatchGroup() | |
var text = "" | |
group.enter() | |
fetchData(0, delay: 0.4) { | |
text += $0 | |
group.leave() | |
} | |
group.enter() | |
fetchData(1, delay: 0.2) { |
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
func combineAsyncCallsWithSemaphore(completionHandler: @escaping (String)->()) { | |
let semaphore = DispatchSemaphore(value: 0) | |
var text = "" | |
DispatchQueue.global().async { | |
fetchData(0, delay: 0.4) { | |
text += $0 | |
semaphore.signal() | |
} | |
semaphore.wait() // wait for the first fetchData complete |
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 initializer is called by NSExtensionContextVendor beginRequestWithExtensionItems, | |
// without it Garage Band will not show the UI! | |
init() { | |
super.init(nibName: "AudioUnitViewController", bundle: Bundle(for: AudioUnitViewController.self)) | |
} | |
override public init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?) { | |
super.init(nibName: "AudioUnitViewController", bundle: Bundle(for: AudioUnitViewController.self)) | |
} | |
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 | |
extension UIFont { | |
static func monospacedFont(at size: CGFloat) -> UIFont{ | |
let bodyFontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: UIFont.TextStyle.body) | |
let bodyMonospacedNumbersFontDescriptor = bodyFontDescriptor.addingAttributes( | |
[ | |
UIFontDescriptor.AttributeName.featureSettings: [ |
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 firebase from 'firebase' | |
// copy the config from the console https://console.firebase.google.com/u/0/project/sign-11111/settings/general/ | |
var firebaseConfig = { | |
apiKey: "AI1111111111111111111111111111", | |
authDomain: "sign-1111111.firebaseapp.com", | |
databaseURL: "https://sign-11111.firebaseio.com", | |
projectId: "sign-11111", | |
storageBucket: "sign-11111.appspot.com", | |
messagingSenderId: "111111111111", |
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
<template> | |
<div class="container"> | |
google-sign | |
</div> | |
</template> | |
<script> | |
export default { | |
created: async function() { | |
} |
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
<template> | |
<div class="container"> | |
<button @click="signInRedirect">Sign With Redirect</button> | |
<button @click="signInPopup">Sign With Pop Up</button> | |
<button @click="test">Test</button> | |
</div> | |
</template> | |
<script> |
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
{ | |
"rules": { | |
".read": "auth.uid != null && auth.token.email.contains('borama')", | |
".write": "auth.uid != null && auth.token.email.contains('borama')" | |
} | |
} |
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
signInPopup: async function() { | |
var provider = new this.$firebase.auth.GoogleAuthProvider() | |
const result = await this.$firebase.auth().signInWithPopup(provider) | |
var user = result.user | |
console.log(user) | |
}, |