Skip to content

Instantly share code, notes, and snippets.

Karol S. Mazur ksm

Block or report user

Report or block ksm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View resume-keywords.md

Keywords

🧙‍♂️ Technologies I Use and Enjoy 👨‍🎓 What I'd Like To Get Better At (Or Learn)
Swift, Xcode, Sublime Text, Git Functional Programming, FRP, JS/React
REST, Swift Codable, Paw.app GraphQL, Server-side Swift, Ruby-on-Rails
Carthage, Fastlane Swift Package Manager
Playground Driven Development, BDD Continuous Integration (CI)
Coordinators/Flow Controllers, Kickstarter-style View Models, Point-Free Dependency Injection Clean Swift
Objective-C, Core Data, ReactiveCocoa, CocoaPods SQLite, Databases
@ksm
ksm / DEPENDENCIES.md
Last active Feb 14, 2019
A sample DEPENDENCIES.md file
View DEPENDENCIES.md

Use this file to track all dependencies required by this project.

Added via Carthage

Alamofire

  • Added because of its MultipartFormData implementation
  • License: MIT

Added via Drag & Drop

@ksm
ksm / gist:593faea8f0ab408dc071eea4e05c8dc1
Created Dec 20, 2018
Carthage failing build log for GRDB.swift
View gist:593faea8f0ab408dc071eea4e05c8dc1
*** xcodebuild output can be found in /var/folders/pz/zn0ztb8n4kl2ts0cd4thqxxh0000gq/T/carthage-xcodebuild.vWS3Sz.log
*** Building scheme "GRDBiOS" in GRDB.xcworkspace
*** Building scheme "GRDBCipheriOS" in GRDB.xcworkspace
*** Building scheme "GRDBCustomSQLiteiOS" in GRDB.xcworkspace
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -workspace /Users/karol/Desktop/portfolio-ios/Carthage/Checkouts/GRDB.swift/GRDB.xcworkspace -scheme GRDBCustomSQLiteiOS -configuration Release -derivedDataPath /Users/karol/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/GRDB.swift/v3.6.1 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/pz/zn0ztb8n4kl2ts0cd4thqxxh0000gq/T/GRDB.swift SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/karol/Desktop/portfolio-ios/Carthage/Checkouts/GRDB.swift)
This usually indicates that project itself faile
@ksm
ksm / UIBarButtonItem+Closure.swift
Last active Sep 13, 2019 — forked from BeauNouvelle/UIBarButtonItem Closure 1.swift
Slightly improved version of Beau Nouvelle's UIBarButtonItem closure extension. I hid all the helper classes within the extension and made them private, so as not to pollute the global namespace. Original article: https://medium.com/@BeauNouvelle/adding-a-closure-to-uibarbuttonitem-24dfc217fe72
View UIBarButtonItem+Closure.swift
import Foundation
import UIKit
public extension UIBarButtonItem {
public typealias TargetClosure = (UIBarButtonItem) -> ()
public convenience init(title: String?, style: UIBarButtonItem.Style = .plain, closure: @escaping TargetClosure) {
self.init(title: title, style: style, target: nil, action: nil)
targetClosure = closure
View git-churn.sh
#!/bin/bash
#
# Written by Corey Haines
# Scriptified by Gary Bernhardt
#
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
# and you'll be able to do `git churn`.
#
# Show churn for whole repo:
# $ git churn
@ksm
ksm / Embedding.swift
Last active Jun 14, 2018
Lets a view controller embed a child view controller.
View Embedding.swift
import UIKit
protocol Embedding: class {
var embeddedViewController: UIViewController? { get set }
}
enum EmbeddingAnimation {
case none
case flipFromLeft
case crossDissolve
@ksm
ksm / LoadThumbnail.swift
Created Jun 17, 2016
One of many Photos.framework idiosyncrasies
View LoadThumbnail.swift
/*
If you run loadThumbnail() in an *iPhone-only app that is installed on the iPad*,
the Photos framework will callback first with a degraded version of the requested asset image,
and then it will callback a second time with a nil image.
If you're not careful and you pass the nil image to your UIImageView, then you will never see the thumbnail.
The UIImageView will first get set with a proper UIImage, then soon after with a nil UIImage.
The solution is to ignore or discard any image that is nil.
So what happens if you try to setup PHImageRequestOptions to make sure that Photos framework only calls back once?
@ksm
ksm / SecRequestSharedWebCredential.swift
Last active Oct 18, 2017
Handling SecRequestSharedWebCredential that works with Xcode 7.2 and Swift 2.
View SecRequestSharedWebCredential.swift
SecRequestSharedWebCredential(nil, nil) { credentials, error in
guard error == nil else {
let cocoaError = error! as NSError
let errorIsExpected = cocoaError.domain == NSOSStatusErrorDomain && cocoaError.code == Int(errSecItemNotFound)
if !errorIsExpected {
// Do something with an unexpected error.
}
return
@ksm
ksm / gist:da1dd59f38babe929c44
Created Nov 23, 2014
Allow a view to capture touches while it is animating (e.g. for interactive animations and transitions)
View gist:da1dd59f38babe929c44
// Presentation Layer Hit Test
// Source: WWDC2014 Session 236
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
CGPoint pointInSuperview = [self convertPoint:point toView:self.superview];
CGPoint presentationLayerPoint = [self.layer.presentationLayer convertPoint:pointInSuperview fromLayer:self.superview.layer];
return [super hitTest:presentationLayerPoint withEvent:event];
}
View gist:3526cac1682c7d165c42
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
You can’t perform that action at this time.