FRP を使った航空券予約サンプル
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
service cloud.firestore { | |
match /databases/{database}/documents { | |
function isAuthenticated() { | |
return request.auth != null; | |
} | |
function isBannedUser(userID) { | |
return exists(/databases/$(database)/documents/bannedUser/$(userID)); | |
} |
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
Skin | |
/m/06z04 | |
0.942024 | |
Hand | |
/m/0k65p | |
0.933021 | |
Flesh | |
/m/02p16m6 | |
0.748568 | |
Beard |
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
let labelDetector = Vision.vision().labelDetector() | |
let image = #imageLiteral(resourceName: "zombie") | |
let visionImage = VisionImage(image: image) | |
labelDetector.detect(in: visionImage) { (labels, error) in | |
guard error == nil, let labels = labels, !labels.isEmpty else { | |
// Error. You should also check the console for error messages. | |
// ... | |
return | |
} |
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
export async function wasTriggered(eventId: string) { | |
return firestore.runTransaction(async t => { | |
const ref = eventIdRef | |
const doc = await t.get(ref) | |
if (doc.exists) { | |
return true | |
} else { | |
t.set(ref, {}) | |
return false | |
} |
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 UIKit | |
import PlaygroundSupport | |
class ViewController: UIViewController { | |
private var scrollView: UIScrollView! | |
private var textField: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
curl -X POST --header "Authorization: key={SERVER_KEY}" \ | |
--Header "Content-Type: application/json" \ | |
https://fcm.googleapis.com/fcm/send \ | |
-d @- << EOF | |
{ | |
"to": "{DEVICE_TOKEN}", | |
"data": { | |
"videoURL": "{URL}" | |
}, | |
"notification": { |
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
try? videoDevice.lockForConfiguration() | |
if newValue > 0.1 { | |
try? videoDevice.setTorchModeOn(level: newValue) | |
} else { | |
videoDevice.torchMode = .off | |
} | |
videoDevice.unlockForConfiguration() |
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 alreadyRunEventIDs = []; | |
function isAlreadyRunning(eventID) { | |
return alreadyRunEventIDs.indexOf(eventID) >= 0; | |
} | |
function markAsRunning(eventID) { | |
alreadyRunEventIDs.push(eventID); | |
} |