-y overwrite without asking
-r frame rate
-vf eq=1:0:1.1:1:1:1:1:1 change colors. contrast : brightness : saturation : gamma : gamma r : gamma g : gamma b : weight
-vf scale=width:height scale/resize. -1 will leave preserved ratio, for instance 320:-1 will resize to 320 in width and keep ratio
-ss seek to position
-t duration, trim to a certain length
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
| // | |
| // URLSessionOperation.swift | |
| // time | |
| // | |
| // Created by Simon Westerlund on 2016-10-23. | |
| // Copyright © 2016 Simon Westerlund. All rights reserved. | |
| // | |
| import UIKit |
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
| extension Mirror { | |
| private func unwrap(any: Any) -> Any? { | |
| let mirror = Mirror(reflecting: any) | |
| if mirror.displayStyle != .Optional { | |
| return any | |
| } | |
| guard let first = mirror.children.first else { | |
| return 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
| extension CGRect { | |
| func resized(size: CGSize, aspectFill: Bool) -> CGRect { | |
| var resizedRect = CGRect.zero; | |
| let aspectWidth = size.width / self.size.width | |
| let aspectHeight = size.height / self.size.height | |
| let aspectRatio = aspectFill ? max(aspectWidth, aspectHeight) : min(aspectWidth, aspectHeight) | |
| resizedRect.size.width = self.size.width * aspectRatio | |
| resizedRect.size.height = self.size.height * aspectRatio |
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
| final class SnappingSlider: UISlider { | |
| override var value: Float { | |
| set { super.value = newValue } | |
| get { | |
| return round(super.value * 1.0) / 1.0 | |
| } | |
| } | |
| } |
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
| // | |
| // Created by Simon Westerlund on 22/12/15. | |
| // Copyright © 2015 Simon Westerlund. All rights reserved. | |
| // | |
| import Foundation | |
| func main() -> Int32 { | |
| let data = NSFileHandle.fileHandleWithStandardInput().readDataToEndOfFile() | |
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
| //: Playground - noun: a place where people can play | |
| import Cocoa | |
| let bounds = CGRectMake(0, 0, 100, 100); | |
| func DrawImageInCGContext(size: CGSize, drawFunc: (context: CGContextRef, rect: CGRect) -> Void) -> NSImage? { | |
| let colorSpace = CGColorSpaceCreateDeviceRGB() | |
| let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.PremultipliedLast.rawValue) | |
| if let context = CGBitmapContextCreate( |
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
| extension NSImage { | |
| func writeToFile(file: String, atomically: Bool, usingType type: NSBitmapImageFileType) -> Bool { | |
| let properties = [NSImageCompressionFactor: 1.0] | |
| guard | |
| let imageData = TIFFRepresentation, | |
| imageRep = NSBitmapImageRep(data: imageData), | |
| fileData = imageRep.representationUsingType(type, properties: properties) else { | |
| return false | |
| } | |
| return fileData.writeToFile(file, atomically: atomically) |
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 dispatch(#after: NSTimeInterval, queue: dispatch_queue_t = dispatch_get_main_queue(), #closure: dispatch_block_t) { | |
| let time = dispatch_time(DISPATCH_TIME_NOW, Int64(Double(after) * Double(NSEC_PER_SEC))) | |
| dispatch_after(time, dispatch_get_main_queue(), closure) | |
| } | |
| func dispatch(#after: NSTimeInterval, closure: dispatch_block_t) { | |
| dispatch(after: after, closure: closure) | |
| } | |
| dispatch(after: 0.5, { () -> Void in |