{{ message }}

Instantly share code, notes, and snippets.

Created Oct 29, 2019
View Publisher+WeakAssign.swift
 import Combine extension Publisher where Self.Failure == Never { /// Assigns each element from a Publisher to a property on an object if it still exists. /// - Parameter keyPath: The key path of the property to assign. /// - Parameter object: The object on which to assign the value, using a weak reference. /// - Returns: A cancellable instance; used when you end assignment of the received value. Deallocation of the result will tear down the subscription stream. /// - Note: Inspired by [OpenCombine](https://github.com/broadwaylamb/OpenCombine). func weakAssign(to keyPath: ReferenceWritableKeyPath, on object: Root?) -> AnyCancellable {
Last active Mar 7, 2019
View SignIn.msd
 #//# -------------------------------------------------------------------------------------- #//# Created using Sequence Diagram for Mac #//# https://www.macsequencediagram.com #//# https://itunes.apple.com/gb/app/sequence-diagram/id1195426709?mt=12 #//# -------------------------------------------------------------------------------------- participant SignInGroup participant SaveAppleID participant SignInProcedure participant AuthConfigProcedure
Last active Feb 18, 2019
Episode #5: Higher-Order Functions
Last active Feb 9, 2019
Episode #4: Algebraic Data Types

Question: What algebraic operation does the function type `(A) -> B` correspond to? Try explicitly enumerating all the values of some small cases like `(Bool) -> Bool`, `(Unit) -> Bool`, `(Bool) -> Three` and `(Three) -> Bool` to get some intuition.

Suggestion: Rather than list all possible unique input/output pairs, try defining every unique function for a given signature.

``````Bool ** Bool = 2 ** 2 = 4:
func f(_ b: Bool) -> Bool { return true }
func f(_ b: Bool) -> Bool { return false }
``````
Created Dec 12, 2018
Mac app notarization from the command line
View Makefile
 .PHONY: notarize SIGNING_CERTIFICATE := \$(shell security find-certificate -Z -c "Developer ID Application:" | grep "SHA-1" | awk 'NF { print \$\$NF }') TEAM_ID := \$(shell security find-certificate -c "Developer ID Application:" | grep "alis" | awk 'NF { print \$\$NF }' | tr -d \(\)\") EXPORT_PATH := \$(XCS_ARCHIVE)/Submissions BUNDLE_APP := \$(EXPORT_PATH)/NewMacApp.app BUNDLE_ZIP := \$(EXPORT_PATH)/NewMacApp.zip UPLOAD_INFO_PLIST := \$(EXPORT_PATH)/UploadInfo.plist REQUEST_INFO_PLIST := \$(EXPORT_PATH)/RequestInfo.plist AUDIT_INFO_JSON := \$(EXPORT_PATH)/AuditInfo.json
Last active Apr 3, 2021
How to delete multiple integrations in Xcode?

# Problem

Xcode does not allow to edit multiple integrations at once, so we should select and delete them one by one. Such a terrible experience.

# Solution

Fortunately, an Xcode Server can be accessed via an API. For example, let’s imagine that your Xcode server is running locally and is logged into macOS as `vadim`. Run the following command in Terminal:

``````curl -u vadim -ki https://localhost:20343/api/integrations
``````
Created Sep 11, 2016
Apple Configuration Profile for Logging in iOS 10 and macOS Sierra
Last active Aug 29, 2015
View Playground.swift
 protocol Value /* : Equatable */ { } // Uncomment results in compiler error struct Foo: Value { } func ==(lhs: Foo, rhs: Foo) -> Bool { return true } struct Bar: Value { } func ==(lhs: Bar, rhs: Bar) -> Bool { return true } protocol Smashable { func valueBySmashing​OtherValue(value: Value) -> Value
Last active Aug 29, 2015
Custom window with re-activation gesture to show the Tweaks panel
View AppDelegate.m
 #if FB_TWEAK_ENABLED #import "CustomTweakWindow.h" #endif - (UIWindow *)newRootWindow { #if FB_TWEAK_ENABLED NSString *windowClassName = @"CustomTweakWindow"; #else NSString *windowClassName = @"UIWindow";
Created Jun 9, 2014
Default parameters for UINavigationController in iOS 7.
View Parameters
 seconds: 0.5 dumping: 10.0 velocity: 0.0