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 'package:async/async.dart'; | |
final Stream<QuerySnapshot> stream0 = collectionReference | |
.snapshots(); | |
final Stream<QuerySnapshot> stream1 = collectionReference | |
.snapshots(); | |
return StreamZip([stream0, stream1]).asBroadcastStream(); |
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
void main() { | |
ErrorWidget.builder = (FlutterErrorDetails details) { | |
return ErrorWidgetPage(details); | |
}; | |
runApp(MyApp()); | |
} | |
class ErrorWidgetPage extends StatelessWidget { | |
ErrorWidgetPage(this.details); |
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 functions = require("firebase-functions"); | |
const firestore = require("@google-cloud/firestore"); | |
const client = new firestore.v1.FirestoreAdminClient(); | |
// Replace BUCKET_NAME | |
const bucket = "gs://firestore_backups_ivadmin_app"; | |
exports.scheduledFirestoreExport = functions.pubsub | |
.schedule("every 24 hours") | |
.onRun((context) => { |
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
class SettingsSignInTableViewCell: UITableViewCell { | |
@IBOutlet private var viewFBLoginButton: UIView! { | |
didSet { | |
// Add tap gesture | |
let tapViewFBLoginButton = UITapGestureRecognizer( | |
target: self, action: #selector(SettingsSignInTableViewCell.tapViewFBLoginButton(_:))) | |
tapViewFBLoginButton.numberOfTapsRequired = 1 | |
viewFBLoginButton.isUserInteractionEnabled = true | |
viewFBLoginButton.addGestureRecognizer(tapViewFBLoginButton) | |
} |
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 SkeletonView | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCell(withIdentifier: "HomeCategoryTableViewCell", | |
for: indexPath) as? HomeCategoryTableViewCell | |
return cell | |
} | |
extension ViewController: SkeletonTableViewDataSource { | |
func collectionSkeletonView(_ skeletonView: UITableView, cellIdentifierForRowAt indexPath: IndexPath) -> ReusableCellIdentifier { |
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 SavedCollectionViewLayout: UICollectionViewLayout { | |
private let columnsCount = 18 // 18 type columns | |
private let numberOfColumns = CGFloat(3.0) | |
private let minimumLineSpacing: CGFloat = 2 | |
private let minimumInteritemSpacing: CGFloat = 2 | |
private var cache: [UICollectionViewLayoutAttributes] = [] | |
private var contentHeight: CGFloat = 0 | |
private var contentWidth: CGFloat { |
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 tapImagePhoto = UITapGestureRecognizer(target: self, action: #selector(YourClass.tapImagePhoto)) | |
tapImagePhoto.numberOfTapsRequired = 2 | |
videoPlayerSuperView.addGestureRecognizer(tapImagePhoto) | |
let tapPlayPause = UITapGestureRecognizer(target: self, action: #selector(YourClass.tapPlayPause)) | |
tapPlayPause.numberOfTapsRequired = 1 | |
videoPlayerSuperView.addGestureRecognizer(tapPlayPause) | |
tapPlayPause.require(toFail: tapImagePhoto2) // important code |
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
self.view.makeToastActivity(.center) | |
DispatchQueue.global(qos: .background).async { | |
if let url = URL(string: self.photo.url), | |
let urlData = NSData(contentsOf: url) | |
{ | |
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]; | |
let filePath="\(documentsPath)/tempFile.mp4" | |
urlData.write(toFile: filePath, atomically: true) | |
PHPhotoLibrary.shared().performChanges({ | |
let assetChangeRequest = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: URL(fileURLWithPath: filePath)) |
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 ImageCache { | |
static func getImage(urlString: String) -> UIImage? { | |
if let dict = UserDefaults.standard.object(forKey: "ImageCache") as? [String:String] { | |
if let path = dict[urlString] { | |
if let data = try? Data(contentsOf: URL(fileURLWithPath: path)) { | |
let img = UIImage(data: data) | |
return img | |
} |
NewerOlder