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 <Foundation/Foundation.h> | |
@interface MyStringUtils : NSObject | |
+ (BOOL)confuzion_stringContainsVotedKeywords:(NSString*)input; | |
+ (BOOL)stringContainsVotedKeywords:(NSString*)input; | |
@end |
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
// copy-paste at the begining of application:didFinishLaunchingWithOptions: | |
for (NSString* family in [UIFont familyNames]) | |
{ | |
NSLog(@"%@", family); | |
for (NSString* name in [UIFont fontNamesForFamilyName: family]) | |
{ | |
NSLog(@" %@", name); | |
} |
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 <Foundation/Foundation.h> | |
@interface NSString (URLValidation) | |
- (BOOL)isValidURL; | |
@end |
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 Foundation | |
class UBINullableSortDescriptor: NSSortDescriptor { | |
override init(key: String, ascending: Bool) { | |
super.init(key: key, ascending: ascending) | |
} | |
required override init(key: String, ascending: Bool, selector: Selector) { | |
super.init(key: key, ascending: ascending, selector: selector) |
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 | |
enum MPSTableViewCellSeparator { | |
case Default, None | |
// returns views for each style - very convinient | |
func view() -> UIView? { | |
switch (self) { | |
case .None: | |
return nil |
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 | |
extension UIColor { | |
class func colorWithComponents(red redComponent: Float, green: Float, blue: Float, alpha: Float) -> UIColor { | |
let r: CGFloat = CGFloat(redComponent/255.0) | |
let g: CGFloat = CGFloat(green/255.0) | |
let b: CGFloat = CGFloat(blue/255.0) | |
let a: CGFloat = CGFloat(alpha) | |
return UIColor(red: r, green: g, blue: b, alpha: a) |
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 Foundation | |
extension NSNumber | |
{ | |
var timeIntervalValue: NSTimeInterval { | |
get { | |
return (self.doubleValue as NSTimeInterval) | |
} | |
// TODO: write a setter | |
} |
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 Foundation | |
private var sDateFormatter: NSDateFormatter = NSDateFormatter() | |
extension NSDate | |
{ | |
convenience | |
init?(fromDateString dateString: String) { | |
sDateFormatter.dateFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'" | |
sDateFormatter.timeZone = NSTimeZone(forSecondsFromGMT: 0) |
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 | |
extension UIColor { | |
class func customGrayColor() -> UIColor { | |
let r: CGFloat = CGFloat(41.0/255.0) | |
let g: CGFloat = CGFloat(41.0/255.0) | |
let b: CGFloat = CGFloat(41.0/255.0) | |
return UIColor(red: r, green: g, blue: b, alpha: 1.0) | |
} |
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 Foundation | |
protocol Validator { | |
func validateWithError(error: NSErrorPointer) -> Bool | |
} | |
/////////////////////////////////////////////// | |
// MARK: - PasswordValidator - | |
/////////////////////////////////////////////// | |
class PasswordValidator: Validator { | |