Skip to content

Instantly share code, notes, and snippets.

View krin-san's full-sized avatar

Alexander Chapliuk krin-san

  • Joyn GmbH
  • Munich, Germany
View GitHub Profile
@krin-san
krin-san / CropVideo.m
Created June 22, 2016 06:17 — forked from zrxq/CropVideo.m
Crop video to square with a specified side respecting the original video orientation
@import MobileCoreServices;
@import AVFoundation;
@import AssetsLibrary;
// ...
- (void)cropVideoAtURL:(NSURL *)videoURL toSquareWithSide:(CGFloat)sideLength completion:(void(^)(NSURL *resultURL, NSError *error))completionHander {
/* asset */
@krin-san
krin-san / NSDate+Compare.swift
Last active August 23, 2016 08:51 — forked from psobot/NSDate+Extensions.swift
Swift NSDate Comparison Extension
// NSDate doesn't include overrides for standard comparison operators in Swift.
// This extension adds <, >, <=, >=, and ==, using NSDate's built-in `compare` method.
// MIT licensed.
func <=(lhs: NSDate, rhs: NSDate) -> Bool {
return lhs.compare(rhs) != .OrderedDescending
}
func >=(lhs: NSDate, rhs: NSDate) -> Bool {
return lhs.compare(rhs) != .OrderedAscending
}
var resultText;
function run(){
var layerSets = app.activeDocument.layerSets;
dumpLayerSets(layerSets);
dumpLayers(app.activeDocument.layers);
}
function dumpLayerSets(layerSets){
var len = layerSets.length;