Skip to content

Instantly share code, notes, and snippets.

View BohdanOrlov's full-sized avatar

Bohdan Orlov BohdanOrlov

View GitHub Profile
@BohdanOrlov
BohdanOrlov / totalLinesOfCode.sh
Created November 5, 2018 17:58
Total lines of code
find . \( -iname Pods -prune \) -o \( -iname \*.m -o -iname \*.mm -o -iname \*.h -o -iname \*.swift \) -print | sed -e 's/"/"\\""/g' -e 's/.*/"&"/' | xargs wc -l | awk '/total/{k+=$1}END{print k,"total"}'
@BohdanOrlov
BohdanOrlov / ViewControllerLifecycleBehavior.swift
Created October 23, 2017 09:36
Swift implementation of idea that manny view controller can do light work: http://khanlou.com/2016/02/many-controllers/
public protocol ViewControllerLifecycleBehavior {
func afterLoading(_ viewController: UIViewController)
func beforeAppearing(_ viewController: UIViewController)
func afterAppearing(_ viewController: UIViewController)
func beforeDisappearing(_ viewController: UIViewController)
func afterDisappearing(_ viewController: UIViewController)
@BohdanOrlov
BohdanOrlov / contacts.m
Created July 15, 2016 12:59
Generate contacts with uk phone numbers
@import AddressBook;
- (void)removeContactWithName:(NSString *)name {
NSString *searchName = name;
ABAddressBookRef addressbook = ABAddressBookCreate();
CFStringRef nameRef = (__bridge CFStringRef) searchName;
CFArrayRef allSearchRecords = ABAddressBookCopyPeopleWithName(addressbook, nameRef);
[self removeContactWithRecordsList:allSearchRecords];
}