This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public class Storage { | |
fileprivate init() { } | |
/// Get the current working directory | |
/// - Returns: URL of current working directory | |
static func getCurrentDirectoryURL() -> URL { | |
return URL(fileURLWithPath: FileManager.default.currentDirectoryPath, isDirectory: true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var connectedRef: FIRDatabaseReference! { | |
return FIRDatabase.database().reference().child(".info/connected") | |
} | |
class FIRConnection { | |
static let sharedInstance = FIRConnection() | |
var handle: UInt? | |
var isConnected = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TAGS="TODO:|FIXME:" | |
echo "searching ${SRCROOT} for ${TAGS}" | |
find "${SRCROOT}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# xcode-git-cfbundleversion.rb | |
# Update CFBundleVersion in Info.plist file with short Git revision string | |
# http://github.com/guicocoa/xcode-git-cfbundleversion/ | |
# | |
# This is based on | |
# http://github.com/digdog/xcode-git-cfbundleversion/ | |
# http://github.com/jsallis/xcode-git-versioner | |
# http://github.com/juretta/iphone-project-tools/tree/v1.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Gathers all the data defined in `Keyboard Notification User Info Keys` from | |
a keyboard will/did show/hide `NSNotification` into an easier to use tuple. | |
- parameter notification: A notification resulting from a keyboard appearance notification, | |
e.g. `UIKeyboardWillShowNotification` | |
- returns: A tuple of data about the keyboard appearance extracted from the notification user info. | |
*/ | |
public func keyboardInfoFromNotification(_ notification: Notification) -> (beginFrame: CGRect, endFrame: CGRect, animationCurve: UIViewAnimationOptions, animationDuration: Double) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func handleTapToFocus(sender: UITapGestureRecognizer) { | |
if let device = captureDevice { | |
let focusPoint = sender.locationInView(previewView) | |
let focusScaledPointX = focusPoint.x / previewView.frame.size.width | |
let focusScaledPointY = focusPoint.y / previewView.frame.size.height | |
if device.isFocusModeSupported(.AutoFocus) && device.focusPointOfInterestSupported { | |
do { | |
try device.lockForConfiguration() | |
} catch { | |
print("ERROR: Could not lock camera device for configuration") |