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
| import UIKit | |
| import XCPlayground | |
| import AVFoundation | |
| func generateThumnail(url : NSURL, fromTime:Float64) -> UIImage { | |
| var asset :AVAsset = AVAsset.assetWithURL(url) as! AVAsset | |
| var assetImgGenerate : AVAssetImageGenerator = AVAssetImageGenerator(asset: asset) | |
| assetImgGenerate.appliesPreferredTrackTransform = true | |
| var error : NSError? = nil | |
| var time : CMTime = CMTimeMakeWithSeconds(fromTime, 600) |
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
| / Returns an iterator containing the primary (built-in) Ethernet interface. The caller is responsible for | |
| // releasing the iterator after the caller is done with it. | |
| func FindEthernetInterfaces() -> io_iterator_t? { | |
| let matchingDictUM = IOServiceMatching("IOEthernetInterface"); | |
| // Note that another option here would be: | |
| // matchingDict = IOBSDMatching("en0"); | |
| // but en0: isn't necessarily the primary interface, especially on systems with multiple Ethernet ports. | |
| if matchingDictUM == 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
| func getAllFontNames() -> [String] { | |
| return UIFont.familyNames().flatMap({ UIFont.fontNamesForFamilyName($0) }) | |
| } | |
| func getRealFontNames(prefix: String) -> [String] { | |
| return getAllFontNames().filter({ $0.lowercaseString.hasPrefix(prefix.lowercaseString) }) | |
| } | |
| let matches = getRealFontNames("Gill") |
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
| import Cocoa | |
| func setTextToPasteBoard(text: String) -> Bool { | |
| let pasteBoard = NSPasteboard.generalPasteboard() | |
| pasteBoard.declareTypes([NSStringPboardType], owner: nil) | |
| return pasteBoard.writeObjects([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 listBase = LSSharedFileListCreate(kCFAllocatorDefault, kLSSharedFileListRecentApplicationItems.takeUnretainedValue(), NSMutableDictionary()) | |
| let list = listBase.takeUnretainedValue() as LSSharedFileListRef | |
| var seed:UInt32 = 0 | |
| let itemsCF = LSSharedFileListCopySnapshot(list, &seed) | |
| if let items = itemsCF.takeUnretainedValue() as? [LSSharedFileListItemRef] { | |
| for item in items { | |
| let listItemURL = LSSharedFileListItemCopyResolvedURL(item, 0, nil) | |
| let urlBase = listItemURL.takeUnretainedValue() | |
| let url = urlBase as NSURL | |
| let listItemName = LSSharedFileListItemCopyDisplayName(item) |
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
| // | |
| // LaunchAtLoginHelper.swift | |
| // | |
| // Created by Erica Sadun on 4/1/15. | |
| // Copyright (c) 2015 Erica Sadun. All rights reserved. | |
| // | |
| import Foundation | |
| public func getLoginItems() -> LSSharedFileList? { |
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
| /* | |
| File: LaunchServices/IconsCore.h | |
| Contains: Icon Utilities and Icon Services Interfaces. | |
| Version: LaunchServices-283~12 | |
| Copyright: � 1990-2006 by Apple Computer, Inc. All rights reserved | |
| Bugs?: For bug reports, consult the following page on |