Skip to content

Instantly share code, notes, and snippets.

View MaximBazarov's full-sized avatar
💤
ZEN

Maxim Bazarov MaximBazarov

💤
ZEN
View GitHub Profile
@AlexKMDev
AlexKMDev / script.sh
Created February 21, 2017 17:40
Carthage Build Phase
for framework in $(find $SRCROOT/Carthage/Build/iOS/ -name "*.framework"); do
SCRIPT_INPUT_FILE_0=$framework SCRIPT_INPUT_FILE_COUNT=1 carthage copy-frameworks
done
@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active November 14, 2024 08:31
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@lattner
lattner / async_swift_proposal.md
Last active October 29, 2024 18:53 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@MaximBazarov
MaximBazarov / WhatToRethinkAndRefactor.sh
Created May 9, 2019 07:06
Show most changing files in the repository
git log --pretty=format: --name-only | sort | uniq -c | sort -rg | head -30
final class Loader: BindableObject {
let didChange = PassthroughSubject<Data?, Never>()
var task: URLSessionDataTask!
var data: Data? = nil {
didSet {
didChange.send(data)
}
}
init(_ url: URL) {
@oleksii-demedetskyi
oleksii-demedetskyi / ReducerBuidler.swift
Created June 12, 2019 12:48
Redux reducer composed using new @functionBuilder api
protocol Action {}
struct Reducer<State> {
let reduce: (State, Action) -> State
}
struct Increment: Action {}
struct Decrement: Action {}
func on<State, A>(_ actionType: A.Type, reduce: @escaping (State, A) -> State) -> Reducer<State> {
protocol _Reducer {
associatedtype State
associatedtype Action
func reduce(state: inout State, action: Action)
}
protocol Reducer: _Reducer where State == Body.State, Action == Body.Action {
associatedtype Body: Reducer
@oleksii-demedetskyi
oleksii-demedetskyi / Draft.swift
Created June 15, 2019 19:47
Allows updates even to let constants and tracking of updates
import Cocoa
protocol Primitive {}
extension Int: Primitive {}
@dynamicMemberLookup
struct Draft<Value> {
let value: Value
var updates: [PartialKeyPath<Value>: Any] = [:]
@oleksii-demedetskyi
oleksii-demedetskyi / ReduceComponents.swift
Last active August 9, 2019 10:38
Combine reducers together with state that they are represent into single structure.
//
// main.swift
// ReducerComponents
//
// Created by Alexey Demedetskii on 6/19/19.
// Copyright © 2019 Sigma software. All rights reserved.
//
import Foundation
extension UIHostingController {
convenience public init(rootView: Content, ignoreSafeArea: Bool) {
self.init(rootView: rootView)
if ignoreSafeArea {
disableSafeArea()
}
}
func disableSafeArea() {