Skip to content

Instantly share code, notes, and snippets.

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

defaults write com.apple.iphonesimulator AllowFullscreenMode -bool YES

@alcamla
alcamla / RealmFileLocation.md
Created February 26, 2020 16:22
Realm file location

po Realm.Configuration.defaultConfiguration.fileURL

@alcamla
alcamla / Singleton.swift
Created December 12, 2019 12:47
Singleton Swift
final class Singleton {
static let shared = Singleton()
private init() {}
}
@alcamla
alcamla / prettyJSON.swift
Created December 10, 2019 22:57
Pretty print JSON in swift
print(String(data: try! JSONSerialization.data(withJSONObject: dict, options: .prettyPrinted), encoding: .utf8)!)
@alcamla
alcamla / snippet
Created December 10, 2019 22:57
git merge without a commit
git merge v1.0 --no-commit --no-ff
@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
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 / introrx.md
Created January 11, 2018 14:41 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
#import <UIKit/UIKit.h>
@interface UIBezierPath (forEachElement)
- (void)forEachElement:(void (^)(CGPathElement const *element))block;
@end