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
import UIKit | |
private class AnyInteractionBase<Settings: InteractionSettings>: Interaction { | |
public var name: String { | |
fatalError() | |
} |
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
typealias TimerTickClosure = (timer : NSTimer)->Void | |
extension NSTimer | |
{ | |
func scheduledTimerWithTimeInterval(interval : NSTimeInterval, callback : TimerTickClosure) -> NSTimer | |
{ | |
func tick(timer : NSTimer) | |
{ | |
callback(timer: timer) | |
} |
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
struct Limit { | |
var maxValue : Int64 | |
private var _value : Int64 | |
var value : Int64 | |
{ | |
set(newValue) { | |
if (newValue <= maxValue) | |
{ | |
_value = newValue | |
} |
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 asyncRequestWithRequest(request: NSURLRequest, completion : (result : Dictionary<String, AnyObject>) -> Void) throws -> Void | |
{ | |
UIApplication.sharedApplication().networkActivityIndicatorVisible = true | |
let semaphore = dispatch_semaphore_create(0) | |
var resultDictionary : Dictionary<String, AnyObject>? = nil | |
var requestError : ErrorType? = nil | |
urlSessionInstance().dataTaskWithRequest(request) { (data, response, error) -> Void in | |
UIApplication.sharedApplication().networkActivityIndicatorVisible = false | |
if let error = error | |
{ |
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
- (BBBigButton *)_mostProbableButtonWithButtons:(NSArray *)buttons | |
{ | |
//returns a random button; | |
NSArray *startedNonExpired = [self startedNonExpiredButtonsFromArray:buttons]; | |
NSArray *randomItemsByProb = [self randomItemsByProbabilityFromArray:startedNonExpired]; | |
BBBigButton *buttonToReturn = nil; | |
if (randomItemsByProb.count == 0) |