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
"use strict"; | |
ObjC.import('Foundation'); | |
var fm = $.NSFileManager.defaultManager; | |
var app = Application.currentApplication(); | |
app.includeStandardAdditions = true; | |
var path = $.NSString.alloc.initWithUTF8String(app.pathTo(this)).stringByDeletingLastPathComponent.js + "/"; |
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 sizes = [ | |
// [ 640, 960, "phone-35"], | |
[ 640, 1136, "phone-40"], | |
[ 750, 1334, "phone-47"], | |
[1242, 2208, "phone-55"], | |
// [ 768, 1024, "pad-x1"], | |
[1536, 2048, "pad-x2"], | |
[2048, 2732, "pad-pro"], | |
]; |
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
// Types work but are not optimal - no error handling | |
// Demo in response to https://gist.github.com/sketchytech/029c00a74a4217a89797 | |
extension CollectionType { | |
func reorder<T>(sorter: [(index: Self.Index, element: T)]) -> Array<Self.Generator.Element> { | |
return sorter.map({self[$0.index]}) | |
} | |
} | |
func sortColumns<T0, T1>(_ col0: Array<T0>, _ col1: Array<T1>, _ cmp: (T0,T0)->Bool) -> (Array<T0>, Array<T1>) { |
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
// C# equivalent of buckets.swift | |
using System; | |
using System.Collections.Generic; | |
interface IFeed { | |
String url { get; } | |
} | |
class LocalFeed : IFeed { | |
public String url { get; set; } |
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
// Protocol | |
protocol Feed { | |
var url : String { get } | |
} | |
// Concrete classes | |
class LocalFeed : Feed { | |
var url : String = "file://Local" | |
} |
NewerOlder