Skip to content

Instantly share code, notes, and snippets.


vadim shpakovski

  • Earth
View GitHub Profile
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](
func weakAssign<Root: AnyObject>(to keyPath: ReferenceWritableKeyPath<Root, Output>, on object: Root?) -> AnyCancellable {
shpakovski /
Last active March 7, 2019 20:10
Sequence Diagram: NativeConnect Sign In
#//# --------------------------------------------------------------------------------------
#//# Created using Sequence Diagram for Mac
#//# --------------------------------------------------------------------------------------
participant SignInGroup
participant SaveAppleID
participant SignInProcedure
participant AuthConfigProcedure
shpakovski /
Last active February 18, 2019 16:39
Episode #5: Higher-Order Functions
shpakovski /
Last active February 9, 2019 19:28
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.

Answer: B ** A.

Bool ** Bool = 2 ** 2 = 4:
func f(_ b: Bool) -> Bool { return true }
func f(_ b: Bool) -> Bool { return false }
shpakovski / Makefile
Created December 12, 2018 11:16
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 \(\)\")
shpakovski /
Last active November 18, 2021 10:20
How to delete multiple integrations in Xcode?


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


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
shpakovski / Extra Logging for My Great App.mobileconfig
Created September 11, 2016 12:06 — forked from zwaldowski/Extra Logging for My Great App.mobileconfig
Apple Configuration Profile for Logging in iOS 10 and macOS Sierra
View Extra Logging for My Great App.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<!-- iOS 10, macOS Sierra, and friends bring a new logging subsystem that's
supposed to scale from the kernel, up to frameworks, and up to apps. It defaults
to a more regimented, privacy-focused approach that large apps and complex
systems need.
It, along with Activity Tracing introduced in iOS 8 and macOS Yosemite and the
Console app in macOS Sierra, hope to help you graduate from caveman debugging to
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
shpakovski / AppDelegate.m
Last active August 29, 2015 14:17
Custom window with re-activation gesture to show the Tweaks panel
View AppDelegate.m
#import "CustomTweakWindow.h"
- (UIWindow *)newRootWindow
NSString *windowClassName = @"CustomTweakWindow";
NSString *windowClassName = @"UIWindow";
shpakovski / Parameters
Created June 9, 2014 08:48
Default parameters for UINavigationController in iOS 7.
View Parameters
seconds: 0.5
dumping: 10.0
velocity: 0.0