I hereby claim:
- I am dslysenko on github.
- I am lysenko (https://keybase.io/lysenko) on keybase.
- I have a public key whose fingerprint is 4087 C50D 1032 765B 843B 1FDF F6EA 64B9 5E00 ED5C
To claim this, I am signing this object:
| // | |
| // Spotify.h | |
| // BeardedSpice | |
| // | |
| // Created by Dennis Lysenko on 4/4/15. | |
| // Copyright (c) 2015 Tyler Rhodes / Jose Falcon. All rights reserved. | |
| // | |
| /* | |
| * Spotify.h |
| - (void)fubar | |
| { | |
| [self fubarWithViews:self.view.subviews]; | |
| } | |
| - (void)fubarWithViews:(NSArray *)views | |
| { | |
| for (UIView *view in views) { | |
| CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 | |
| CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white | |
| CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black |
| // | |
| // SpotifyTabAdapter.m | |
| // BeardedSpice | |
| // | |
| // Created by Dennis Lysenko on 4/4/15. | |
| // Copyright (c) 2015 Tyler Rhodes / Jose Falcon. All rights reserved. | |
| // | |
| #import "SpotifyTabAdapter.h" | |
| #import "runningSBApplication.h" |
| // 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> |
I hereby claim:
To claim this, I am signing this object:
| // Setup: We want to arm a NuclearWarhead and get a LaunchCode from it but there's a 1/10 chance of a PrematureDetonationError | |
| // (nb: if Swift had any kind of useful random generator that I could pick up in 5 seconds I would use that instead of this pseudorandom-at-best algorithm) | |
| struct NuclearWarhead {} | |
| struct LaunchCode {} | |
| struct PrematureDetonationError: ErrorType {} | |
| func armNuclearWarhead(warhead: NuclearWarhead) throws -> LaunchCode { | |
| let currentTimestamp = NSDate().timeIntervalSince1970 | |
| let lastDigit = currentTimestamp % 10 | |
| if lastDigit == 8 { |
I hereby claim:
To claim this, I am signing this object:
| // Profile your code when you're too lazy to use Instruments | |
| // Method one: get the time to execute a block | |
| func getTimeToExecute(block: () throws -> Void) rethrows -> NSTimeInterval { | |
| let start = NSDate().timeIntervalSince1970 | |
| try block() | |
| return NSDate().timeIntervalSince1970 - start | |
| } | |
| // example: |
| // | |
| // 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. | |
| // |