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
import UIKit | |
public extension UIView { | |
public var width: CGFloat { | |
set { | |
bounds.size.width = newValue | |
} | |
get { | |
return bounds.size.width | |
} |
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
// | |
// SimpleMediaSaver.swift | |
// | |
// Created by Dennis Lysenko on 27-09-16. | |
// Copyright © 2016 Dennis Lysenko. All rights reserved. | |
// https://gist.github.com/dennislysenko/5388cacb83b754e8983e99bff7fef2d2 | |
// | |
// This gist is licensed under the terms of the MIT license. | |
// |
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
// Fuzzy string-matching algorithm | |
// Implementation of algorithm described at: http://blog.notdot.net/2007/4/Damn-Cool-Algorithms-Part-1-BK-Trees | |
// Essentially builds an index of strings by levenshtein distance (N-ary tree) on which you can run range queries. | |
// The root node can be chosen arbitrarily. Each node holds a string and a collection of edges, representing distance to other strings, which then have their own children and so on, building a complete index. | |
// See https://github.com/vy/bk-tree for (impressive) performance statistics despite this tending to create an unbalanced N-ary tree | |
class BKTreeNode { | |
var value: String | |
var edges: Dictionary<Int, BKTreeNode> |
OlderNewer