Skip to content

Instantly share code, notes, and snippets.

View bguidolim's full-sized avatar

Bruno Guidolim bguidolim

View GitHub Profile
import Foundation
public final class Debouncer {
public var isCancelled: Bool { workItem.isCancelled }
private lazy var queue: DispatchQueue = {
DispatchQueue(label: "com.traderepublic.debouncer", target: .global())
}()
private var workItem: DispatchWorkItem = .init(block: {})
Crashed: Engage.Database.Operations.Queue
0 Realm 0x101770944 realm::Array::init_from_mem(realm::MemRef) + 20
1 Realm 0x101502290 realm::Array::init_from_ref(unsigned long) + 8368
2 Realm 0x1017fb804 realm::Cluster::init_leaf(realm::ColKey, realm::ArrayPayload*) const + 184
3 Realm 0x10158ada4 realm::LinkMap::set_cluster(realm::Cluster const*) + 2624 (memory:2624)
4 Realm 0x10187e9c8 realm::ParentNode::match(realm::ConstObj&) + 224
5 Realm 0x1016fd67c realm::Query::do_count(unsigned long) const + 144
6 Realm 0x1016fdbc4 realm::Query::count(realm::DescriptorOrdering const&) + 208
7 Realm 0x1015363c0 realm::Results::do_size() + 163 (results.cpp:163)
8 Realm 0x10153b108 realm::Results::size() + 140 (results.cpp:140)
Crashed: Engage.Database.Operations.Queue
0 Realm 0x1016e3bfc realm::util::EncryptedFileMapping::read_barrier(void const*, unsigned long, unsigned long (*)(char const*)) + 96
1 Realm 0x10131233c realm::util::do_encryption_read_barrier(void const*, unsigned long, unsigned long (*)(char const*), realm::util::EncryptedFileMapping*) + 8540
2 Realm 0x101312268 realm::Array::init_from_ref(unsigned long) + 8328
3 Realm 0x10160b804 realm::Cluster::init_leaf(realm::ColKey, realm::ArrayPayload*) const + 184
4 Realm 0x10139ada4 realm::LinkMap::set_cluster(realm::Cluster const*) + 2624 (memory:2624)
5 Realm 0x10168e9c8 realm::ParentNode::match(realm::ConstObj&) + 224
6 Realm 0x10150d67c realm::Query::do_count(unsigned long) const + 144
7 Realm 0x10150dbc4 realm::Query::count(realm::DescriptorOrdering const&) + 208
8
Crashed: Engage.Database.Operations.Queue
0 Realm 0x102197330 realm::util::EncryptedFileMapping::read_barrier(void const*, unsigned long, unsigned long (*)(char const*)) + 32
1 Realm 0x101e87090 realm::util::do_encryption_read_barrier(void const*, unsigned long, unsigned long (*)(char const*), realm::util::EncryptedFileMapping*) + 8068
2 Realm 0x101e86fc8 realm::Array::init_from_ref(unsigned long) + 7868
3 Realm 0x1020be574 realm::Cluster::init_leaf(realm::ColKey, realm::ArrayPayload*) const + 184
4 Realm 0x101f0ddf4 realm::LinkMap::set_cluster(realm::Cluster const*) + 2624 (memory:2624)
5 Realm 0x102141430 realm::ParentNode::match(realm::ConstObj&) + 228
6 Realm 0x101fbec58 realm::Query::do_count(unsigned long) const + 144
7 Realm 0x101fbf1ec realm::Query::count(realm::DescriptorOrdering const&) + 208
8
extension String {
/// Check if a string contains in other string considering a minimum match percentage.
/// - Parameters:
/// - string: String that should be tested.
/// - matchPercentage: The minimum match percentage.
/// - Returns: Boolean indication if the requeriment was matched.
public func contains(_ string: String, matchPercentage: Float) -> Bool {
let set1 = Set<String>(self.components(separatedBy: .whitespaces))
let set2 = Set<String>(string.components(separatedBy: .whitespaces))
let match: Set<String> = set1.intersection(set2)
@bguidolim
bguidolim / ChatCollectionViewFlowLayout.swift
Created November 9, 2019 01:59
Link Preview implementation using MessageKit
//
// ChatCollectionViewFlowLayout.swift
// Engage
//
// Created by Bruno Guidolim on 04.08.19.
// Copyright © 2019 COYO GmbH. All rights reserved.
//
import MessageKit
import UIKit
let userJson = """
{
"id": "4yq6txdpfadhbaqnwp3",
"age": 5,
"name":"John Doe",
"properties": {
"dynamicKeyA": "1",
"dynamicKeyB": "2",
@bguidolim
bguidolim / FilePreview.swift
Last active June 7, 2023 01:49
FilePreview is a easy way to open in-app some kind of files (PDF, DOC, XLS, TXT, images, etc) as read only. This is a simple implementation using WKWebView but with an interface to check if is possible to open the file before showing the ViewController.
//
// FilePreview.swift
// COYO Messenger Framework
//
// Created by Bruno Guidolim on 21.11.18.
// Copyright © 2018 COYO. All rights reserved.
//
import Foundation
import WebKit
@bguidolim
bguidolim / HTTPStatusCode.swift
Created April 20, 2018 13:38 — forked from ollieatkinson/HTTPStatusCode.swift
HTTP status codes as a Swift enum.
/// This is a list of Hypertext Transfer Protocol (HTTP) response status codes.
/// It includes codes from IETF internet standards, other IETF RFCs, other specifications, and some additional commonly used codes.
/// The first digit of the status code specifies one of five classes of response; an HTTP client must recognise these five classes at a minimum.
enum HTTPStatusCode: Int, Error {
/// The response class representation of status codes, these get grouped by their first digit.
enum ResponseType {
/// - informational: This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line.
case informational

Keybase proof

I hereby claim:

  • I am bguidolim on github.
  • I am bguidolim (https://keybase.io/bguidolim) on keybase.
  • I have a public key ASDqo6vFX8iyp8dcNkVorpT8yjJg3xH3U1nMydaCh8qPOwo

To claim this, I am signing this object: