Skip to content

Instantly share code, notes, and snippets.

View gabrielribeiro's full-sized avatar

Gabriel Ribeiro gabrielribeiro

View GitHub Profile
@tera-ny
tera-ny / Document.swift
Last active July 30, 2024 19:42
Swift + Combine + Firestore
import Foundation
import FirebaseFirestoreSwift
import FirebaseFirestore
import Combine
struct Document<Model: Codable> {
let ref: DocumentReference
let data: Model
static func get(collectionPath: String, id: String) -> Deferred<Future<Document<Model>, Error>> {
.init { () -> Future<Document<Model>, Error> in
@DreamingInBinary
DreamingInBinary / Best in Class iOS Checklist
Last active January 24, 2025 03:26
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support
// Created by gil_birman on 11/22/19.
import Combine
import FirebaseFirestore
import FirebaseStorage
import Foundation
enum FirebaseCombineError: Error {
case encodeImageFailed
case nilResultError
@zntfdr
zntfdr / firebase-iOS-breakdown.swift
Last active September 24, 2024 06:29
Firebase iOS Version breakdown
// How to:
// 1. Open the Firebase Analytics Dashboard
// 2. Scroll to bottom, where you see the "Users by Device model" widget
// 3. Click "View device models" in that widget (this opens the "Tech details" Firebase Analytics page)
// 4. Above the table shown in the new page, click on the “Device model” drop down menu and select “OS with Version”
// 5. Make sure to select “OS with version” and not “OS Version”
// 6. On the top right corner of the page, click on the “Share this report” icon (next to the date)
// 7. Click “Download file” on the new side bar, then “Download CSV"
// 8. Open the file and select the iOS/Android breakdown raw data
// 9. Replace the sample data in this script with your data
@johnkors
johnkors / .sshconfig
Created October 20, 2019 04:42
SSH config working with Azure DevOps and others
# https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops#i-have-multiple-ssh-keys--how-do-i-use-different-ssh-keys-for-different-ssh-servers-or-repos
Host ssh.dev.azure.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa.azureaccount
IdentitiesOnly yes
User git
Host *
@mshafer
mshafer / ContentView.swift
Last active October 11, 2024 13:00
Slide-over card (like in Maps or Stocks) using SwiftUI
import SwiftUI
struct ContentView : View {
var body: some View {
ZStack(alignment: Alignment.top) {
MapView()
SlideOverCard {
VStack {
CoverImage(imageName: "maitlandbay")
Text("Maitland Bay")
@atanasovdejan
atanasovdejan / UpdateProfileInfo.swift
Created August 4, 2018 11:13
Update Profile Picture and Display Name in Firebase User
func updateProfileInfo(withImage image: Data? = nil, name: String? = nil, _ callback: ((Error?) -> ())? = nil){
guard let user = Auth.auth().currentUser else {
callback?(nil)
return
}
if let image = image{
let profileImgReference = Storage.storage().reference().child("profile_pictures").child("\(user.uid).png")
_ = profileImgReference.putData(image, metadata: nil) { (metadata, error) in
@maysamsh
maysamsh / UISearchBar+Ext.swift
Last active March 14, 2022 01:07
A small extension for UISearchBar which shows an UIActivityIndicator while searching
//
// UISearchBar+Ext.swift
// frazeit
//
// Created by Maysam Shahsavari on 7/30/18.
// Updated on 9/26/19.
// Copyright © 2018 Maysam Shahsavari. All rights reserved.
// Updated: 10/02/2020.
import Foundation
@h3nr1ke
h3nr1ke / fix_android_err_spawn.sh
Created February 21, 2018 10:13
Fix Error: spawn EACCES when running cordova build android
# run it from your project folder
# based on this link
# https://github.com/ionic-team/ionic-cli/issues/2835
# erroroccurs when run...
cordova build android
# ANDROID_HOME=/usr/local/Caskroom/android-platform-tools/27.0.1
# JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
# Error: spawn EACCES
public async Task<IActionResult> OnPostExport()
{
string sWebRootFolder = _hostingEnvironment.WebRootPath;
string sFileName = @"demo.xlsx";
string URL = string.Format("{0}://{1}/{2}", Request.Scheme, Request.Host, sFileName);
FileInfo file = new FileInfo(Path.Combine(sWebRootFolder, sFileName));
var memory = new MemoryStream();
using (var fs = new FileStream(Path.Combine(sWebRootFolder, sFileName), FileMode.Create, FileAccess.Write))
{
IWorkbook workbook;