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 firestore = require('@google-cloud/firestore'); | |
const { storageBucket, projectId } = require('...'); | |
const client = new firestore.v1.FirestoreAdminClient(); | |
const firestoreBackup = functions | |
.runWith({ memory: '512MB', timeoutSeconds: 540 }) | |
.pubsub | |
.schedule('every 24 hours') |
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 AVFoundation | |
class VideoWriter { | |
fileprivate var writer: AVAssetWriter | |
fileprivate var writerInput: AVAssetWriterInput | |
fileprivate var pixelBufferAdaptor: AVAssetWriterInputPixelBufferAdaptor | |
fileprivate let queue: DispatchQueue | |
static var ciContext = CIContext.init() // we reuse a single context for performance reasons |
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 { useLayoutEffect, useState } from 'react'; | |
import loadBeacon from './loadBeacon'; | |
const BeaconLoader = () => { | |
const [didLoad, setDidLoad] = useState(false); | |
useLayoutEffect(() => { | |
if (!didLoad && myConditionForWantingTheBeaconToShow) { | |
setDidLoad(true); | |
loadBeacon({ displayName, email, helpscoutSignature }); // parameters are optional, see loadBeacon.js |
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
/* eslint-disable no-underscore-dangle */ | |
/* eslint-disable no-multi-assign */ | |
/* | |
* License: contains code from various sources, including https://github.com/gka/chroma.js/, which has Apache2 license | |
* Author's contributions: public domain / no attribution required. | |
* You're on your own to figure out if you can use this code in your project, author disclaims all liability. | |
* | |
*/ |
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 Foundation | |
// SINGLE VARIANT - Observer only has one thing it is watching | |
protocol IsObserver: class { | |
associatedtype DataType | |
func dataDidUpdate(_ data: [DataType]) | |
} | |
protocol HasObserver { |
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 express = require('express'); | |
const bodyParser = require('body-parser'); | |
const { stripe, webhookSecret } = require('./index'); | |
const router = express(); | |
router.post('/stripe/webhook', bodyParser.raw({ type: 'application/json' }), async (req, res, next) => { | |
const sig = req.headers['stripe-signature']; | |
let event; | |
try { |
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 | |
protocol Animal {} | |
class Cat : Animal {} | |
class Dog : Animal {} | |
class GreatDane : Dog {} | |
let c = Cat() | |
let d = Dog() | |
let gd = GreatDane() |
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 Foundation | |
protocol KeyedStruct { | |
var type_: String { get set } | |
} | |
struct Inputs : Codable { | |
struct KeyStruct : KeyedStruct, Codable { | |
var type_: String | |
} |
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
// note that currentFirstResponder is obtained by this: | |
// | |
// static var currentFirstResponder: UIResponder? | |
// func findFirstResponder(sender: Any) { | |
// currentFirstResponder = self | |
// } | |
// | |
// class func currentFirstResponder() -> UIResponder? { | |
// currentFirstResponder = nil | |
// UIApplication.shared.sendAction(#selector(findFirstResponder), to: nil, from: nil, for: nil) |
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
// | |
// RXTimer.h | |
// | |
// Copyright 2013 Andreas Grosam | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 |