This file contains hidden or 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
// https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLPlacemark_class/index.html#//apple_ref/occ/cl/CLPlacemark | |
CLGeocoder().reverseGeocodeLocation(location) { (placemarks, err) -> Void in | |
if let p = placemarks { | |
let address = p[0].name! | |
self.locationLabel.text = address | |
} else { | |
self.locationLabel.text = "" |
This file contains hidden or 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
let formatter = NSDateFormatter() | |
formatter.dateStyle = .NoStyle | |
formatter.timeStyle = .ShortStyle | |
let dateString = formatter.stringFromDate(taken) | |
timeTaken.text = " \(dateString) " |
This file contains hidden or 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
override func prefersStatusBarHidden() -> Bool { | |
return true | |
} | |
override func preferredStatusBarStyle() -> UIStatusBarStyle { | |
return UIStatusBarStyle.LightContent | |
} | |
override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation { | |
return UIStatusBarAnimation.Slide |
This file contains hidden or 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
func getDifferenceString(start:NSDate, end:NSDate) -> String { | |
let calendar: NSCalendar = NSCalendar.currentCalendar() | |
let components = calendar.components([.Day, .Hour, .Minute, .Second], | |
fromDate: start, | |
toDate: end, | |
options: []) | |
let d = components.day | |
let h = components.hour |
This file contains hidden or 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
func wordRangeAtIndex(index:Int, inString str:NSString) -> NSRange { | |
let tagger = NSLinguisticTagger(tagSchemes: [NSLinguisticTagSchemeTokenType], options: 0) | |
var r : NSRange = NSMakeRange(0,0) | |
tagger.string = str as String | |
tagger.tagAtIndex(index, scheme: NSLinguisticTagSchemeTokenType, tokenRange: &r, sentenceRange: nil ) | |
return r | |
} | |
func wordAtIndex(index:Int, inString str:NSString) -> NSString { | |
return str.substringWithRange(wordRangeAtIndex(index, inString: str)) |
This file contains hidden or 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
func wordRangeAtIndex(index:Int, inString str:NSString) -> NSRange { | |
let tagger = NSLinguisticTagger(tagSchemes: [NSLinguisticTagSchemeTokenType], options: 0) | |
var r : NSRange = NSMakeRange(0,0) | |
tagger.string = str as String | |
tagger.tagAtIndex(index, scheme: NSLinguisticTagSchemeTokenType, tokenRange: &r, sentenceRange: nil ) | |
return r | |
} | |
func wordAtIndex(index:Int, inString str:NSString) -> NSString { | |
return str.substringWithRange(wordRangeAtIndex(index, inString: str)) |
This file contains hidden or 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
func selectFolder(){ | |
let openPanel = NSOpenPanel(); | |
openPanel.title = "Select a folder to watch for videos" | |
openPanel.message = "Videos you drop in the folder you select will be converted to animated gifs" | |
openPanel.showsResizeIndicator=true; | |
openPanel.canChooseDirectories = true; | |
openPanel.canChooseFiles = false; | |
openPanel.allowsMultipleSelection = false; | |
openPanel.canCreateDirectories = true; | |
openPanel.delegate = self; |
This file contains hidden or 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
Frame 1: 268 bytes on wire (2144 bits), 268 bytes captured (2144 bits) on interface 0 | |
Interface id: 0 (en0) | |
Encapsulation type: IEEE 802.11 plus radiotap radio header (23) | |
Arrival Time: Nov 21, 2015 10:36:49.097915000 PST | |
[Time shift for this packet: 0.000000000 seconds] | |
Epoch Time: 1448131009.097915000 seconds | |
[Time delta from previous captured frame: 0.000000000 seconds] | |
[Time delta from previous displayed frame: 0.000000000 seconds] | |
[Time since reference or first frame: 0.000000000 seconds] | |
Frame Number: 1 |
This file contains hidden or 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
let rotate = CABasicAnimation(keyPath: "transform.rotation") | |
rotate.fillMode = kCAFillModeForwards | |
rotate.fromValue = 0.0 | |
rotate.toValue = CGFloat(M_PI * 2.0) | |
rotate.duration = 1 | |
rotate.repeatCount = Float.infinity | |
loaderView.layer?.position = CGPointMake(CGRectGetMidX(loaderView.frame), CGRectGetMidY(loaderView.frame)) | |
loaderView.layer?.anchorPoint = CGPointMake(0.5, 0.5) | |
loaderView.layer?.addAnimation(rotate, forKey: nil) |
This file contains hidden or 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
// Appdelegate, view did finish loading | |
var win = NSApplication.sharedApplication().windows.first! | |
win.titlebarAppearsTransparent = true | |
win.movableByWindowBackground = true | |
win.styleMask = win.styleMask | NSFullSizeContentViewWindowMask; | |
win.title = "" |