Skip to content

Instantly share code, notes, and snippets.

View danya61's full-sized avatar

Daniil Vorobyev danya61

View GitHub Profile
@danya61
danya61 / city-ios-techradar.json
Created February 5, 2022 09:26
Techradar citymobil
[{"name":"MVVM","ring":"Adopt","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Object - Orientired Programming","ring":"Adopt","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Citygile","ring":"Trial","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"SPM","ring":"Assess","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Kanban","ring":"Hold","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Reactive Programming","ring":"Adopt","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Dependency Injection","ring":"Adopt","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Auto-generators","ring":"Adopt","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Feature Toggles","ring":"Adopt","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Unit testing","ring":"Adopt","quadrant":"Techniques / Технологии","isNew":"ЛОЖЬ"},{"name":"Cocoapods / Cocoapods-Binary","ring":"Adopt","quadrant":"Techniques / Технологии","isNew":
@danya61
danya61 / Inheritance base.
Created June 6, 2021 10:56
Netology task: Inheritance.
import UIKit
import PlaygroundSupport
/// Создадим класс рыбы с несколькими методами и свойством
class Fish {
var isItDefinitelySharkStored: Bool = false
var isItDefinitelySharkComputed: Bool {
return false
}
import Accelerate
import UIKit
extension UIImage {
// MARK: - Types
private struct BlurComponents {
/// Blur Radius. Mutable proeprty, feel free to change it
extension UIView {
func asImage(nonAlphaBackgroundColor: UIColor?) -> UIImage {
let savedColor = backgroundColor
let savedCornerRadius = layer.cornerRadius
layer.cornerRadius = 0
backgroundColor = nonAlphaBackgroundColor
defer {
backgroundColor = savedColor
@danya61
danya61 / type_erasure
Created July 15, 2019 19:17
type erasure collection
protocol CellViewModel: AnyObject {
associatedtype Cell
var id: Int { get }
func setup(cell: Cell)
}
class AnyCellViewModel<CollectionType: UIView>: CellViewModel {
@danya61
danya61 / service-locator
Created May 21, 2019 13:29
Service Locator
final class ServiceLocator {
private lazy var services: Dictionary<String, Any> = [:]
private func typeName(some: Any) -> String {
return (some is Any.Type) ?
"\(some)" : "\(some.dynamicType)"
}
func addService<T>(service: T) {
let key = typeName(T)
services[key] = service
let queue1 = DispatchQueue(label: "com.playground.thread1", attributes: .concurrent)
let queue2 = DispatchQueue(label: "com.playground.thread2")
queue1.async {
queue2.async {
print("1")
queue1.sync {
sleep(1)
let queue1 = DispatchQueue(label: "com.playground.thread1")
let queue2 = DispatchQueue(label: "com.playground.thread2")
queue1.async {
queue2.async {
print("1")
queue1.sync {
sleep(1)
let queue1 = DispatchQueue(label: "com.playground.thread1")
queue1.async {
queue1.async {
print("1")
}
print("2")
var counter = 0
@danya61
danya61 / working
Created May 11, 2019 11:29
async2
queue1.sync {
emoji1()
}
queue2.async {
emoji2()
}