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
package amal.global.amal | |
import android.content.Context | |
import android.graphics.Bitmap | |
import android.graphics.BitmapFactory | |
import android.util.LruCache | |
import com.google.firebase.storage.StorageReference | |
import com.jakewharton.disklrucache.DiskLruCache | |
import java.io.File | |
import java.security.MessageDigest |
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 PassThroughView: UIView { | |
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { | |
let result = super.hitTest(point, with: event) | |
if result == self { return nil } | |
return result | |
} | |
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
public struct ReversibleRange<Bound>: Equatable where Bound: Comparable { | |
public let startingBound: Bound | |
public let endingBound: Bound | |
public init(startingBound: Bound, endingBound: Bound) { | |
self.startingBound = startingBound | |
self.endingBound = endingBound | |
} | |
public var isReversed: Bool { |
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
public extension BinaryFloatingPoint { | |
public func scaled(from source: ReversibleRange<Self>, to destination: ReversibleRange<Self>) -> Self { | |
let destinationStart = destination.lowerBound | |
let destinationEnd = destination.upperBound | |
let selfMinusLower = self - source.lowerBound | |
let sourceUpperMinusLower = source.upperBound - source.lowerBound | |
let destinationUpperMinusLower = destinationEnd - destinationStart |
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
extension CharacterSet { | |
func contains(_ character: Character) -> Bool { | |
guard let firstScalar = character.unicodeScalars.first else { return false } | |
return self.contains(firstScalar) | |
} | |
} |
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 Foundation | |
/** | |
Decode an array of objects while simply omitting any nested objects that themselves fail to be decoded. | |
Inspired by https://stackoverflow.com/a/46369152/503916 | |
*/ | |
struct SafeDecodableArray<T: Decodable>: Decodable { | |
/* | |
An intermediate type that always succeeds at being decoded. Necessary because when iterating the |
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 PassThroughView: UIView { | |
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { | |
return nil | |
} | |
} | |
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
/// A strided non-contiguous sequence of elements that incorporates | |
/// every nth element of a base sequence. | |
public struct StridedSequence<BaseSequence: Sequence> : Sequence, IteratorProtocol { | |
public mutating func next() -> BaseSequence.Element? { | |
defer { | |
for _ in 0 ..< _strideLength - 1 { | |
let _ = _iterator.next() | |
} | |
} |
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
struct SortedArray<Element, ComparableProperty: Comparable> { | |
let propertyAccessor: (Element) -> ComparableProperty | |
private var elements: [Element] | |
public init(propertyAccessor: @escaping (Element) -> ComparableProperty) { | |
self.elements = [] | |
self.propertyAccessor = propertyAccessor | |
} |
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
disabled_rules: | |
- file_length | |
- line_length | |
- function_body_length | |
- redundant_discardable_let | |
- identifier_name | |
- void_return | |
- todo | |
- trailing_whitespace | |
- force_cast |