Skip to content

Instantly share code, notes, and snippets.

@andreyz
andreyz / about.md
Created August 10, 2011 19:57 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer

Keybase proof

I hereby claim:

  • I am andreyz on github.
  • I am andreyz (https://keybase.io/andreyz) on keybase.
  • I have a public key whose fingerprint is C8AA 43DE 0B55 A0B6 6F25 A6A9 52BA F05C 980F 07B3

To claim this, I am signing this object:

import UIKit
class TouchForwardingView: UIView {
var passthroughViews: [UIView] = []
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard let hitView = super.hitTest(point, with: event) else { return nil }
guard hitView == self else { return hitView }
@andreyz
andreyz / UIEdgeInsets+Extension.swift
Last active February 17, 2018 21:59
Initialisers through key paths
public extension UIEdgeInsets {
public var vertical: CGFloat {
get { return 0 } // meaningless but not fatal
set { (top, bottom) = (newValue, newValue) }
}
public var horizontal: CGFloat {
get { return 0 } // meaningless but not fatal
set { (left, right) = (newValue, newValue) }
}
[
{
"name": "Admir Rocks",
"category": "Featured",
"city": "Huddik",
"state": "Norrland",
"id": 1000,
"park": "Joshua Tree National Park",
"coordinates": {
"longitude": -116.166868,
@andreyz
andreyz / ManagedObjectChangesPublisher.swift
Created April 29, 2020 18:45 — forked from mjm/ManagedObjectChangesPublisher.swift
Observe changes to a Core Data fetch request with Combine
import Combine
import CoreData
extension NSManagedObjectContext {
func changesPublisher<Object: NSManagedObject>(for fetchRequest: NSFetchRequest<Object>)
-> ManagedObjectChangesPublisher<Object>
{
ManagedObjectChangesPublisher(fetchRequest: fetchRequest, context: self)
}
}
import SwiftUI
import WebKit
import Combine
class WebViewData: ObservableObject {
@Published var loading: Bool = false
@Published var scrollPercent: Float = 0
@Published var url: URL? = nil
@Published var urlBar: String = "https://nasa.gov"
@andreyz
andreyz / SwiftUI-TextView.swift
Created September 12, 2020 19:56 — forked from shaps80/SwiftUI-TextView.md
A SwiftUI view that wraps a UITextView but provides almost all functionality though modifiers and attempts to closely match the Text/TextField components.
/*
Notes:
The font modifier requires the following gist:
https://gist.github.com/shaps80/2d21b2ab92ea4fddd7b545d77a47024b
*/
//
// BottomSheetView.swift
//
// Created by Majid Jabrayilov
// Copyright © 2019 Majid Jabrayilov. All rights reserved.
//
import SwiftUI
fileprivate enum Constants {
static let radius: CGFloat = 16
import Combine
import ComposableArchitecture
import UserNotifications
public struct UserNotificationClient {
public var add: (UNNotificationRequest) -> Effect<Void, Error>
public var delegate: Effect<DelegateEvent, Never>
public var getNotificationSettings: Effect<Notification.Settings, Never>
public var removeDeliveredNotificationsWithIdentifiers: ([String]) -> Effect<Never, Never>
public var removePendingNotificationRequestsWithIdentifiers: ([String]) -> Effect<Never, Never>