Skip to content

Instantly share code, notes, and snippets.

View UIBezierPath+forEachElement.h
#import <UIKit/UIKit.h>
@interface UIBezierPath (forEachElement)
- (void)forEachElement:(void (^)(CGPathElement const *element))block;
@end
@alcamla
alcamla / introrx.md
Created January 11, 2018 14:41 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@alcamla
alcamla / AppDelegate.swift
Created May 30, 2018 21:39 — forked from jonathan-beebe/AppDelegate.swift
Detect if a Swift iOS app delegate is running unit tests
View AppDelegate.swift
import UIKit
// Detect if the app is running unit tests.
// Note this only detects unit tests, not UI tests.
func isRunningUnitTests() -> Bool {
let env = NSProcessInfo.processInfo().environment
if let injectBundle = env["XCInjectBundle"] {
return NSString(string: injectBundle).pathExtension == "xctest"
}
return false
@alcamla
alcamla / snippet
Created December 10, 2019 22:57
git merge without a commit
View snippet
git merge v1.0 --no-commit --no-ff
@alcamla
alcamla / prettyJSON.swift
Created December 10, 2019 22:57
Pretty print JSON in swift
View prettyJSON.swift
print(String(data: try! JSONSerialization.data(withJSONObject: dict, options: .prettyPrinted), encoding: .utf8)!)
@alcamla
alcamla / Singleton.swift
Created December 12, 2019 12:47
Singleton Swift
View Singleton.swift
final class Singleton {
static let shared = Singleton()
private init() {}
}
@alcamla
alcamla / RealmFileLocation.md
Created February 26, 2020 16:22
Realm file location
View RealmFileLocation.md

po Realm.Configuration.defaultConfiguration.fileURL

@alcamla
alcamla / fullScreenSimulator.md
Created March 5, 2020 15:30
Enable Xcode simulator full screen
View fullScreenSimulator.md

defaults write com.apple.iphonesimulator AllowFullscreenMode -bool YES