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
| class SessionManager: AFHTTPSessionManager { | |
| typealias SuccessCompletionBlock = (session:NSURLSessionDataTask!, responseObject:AnyObject!) -> Void | |
| typealias ErrorCompletionBlock = (session:NSURLSessionDataTask!, error:NSError!) -> Void | |
| class var sharedInstance: SessionManager | |
| { | |
| struct Static | |
| { | |
| static var onceToken: dispatch_once_t = 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
| func uniq<S : SequenceType, T : Hashable where S.Generator.Element == T>(source: S) -> [T] { | |
| var buffer = [T]() | |
| var added = Set<T>() | |
| for elem in source { | |
| if !added.contains(elem) { | |
| buffer.append(elem) | |
| added.insert(elem) | |
| } | |
| } | |
| return buffer |
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
| class MyClass: NSObject { | |
| // MARK: Singleton | |
| class var sharedInstance : MyClass { | |
| struct Static { | |
| static var onceToken:dispatch_once_t = 0 | |
| static var instance:MyClass? = nil | |
| } | |
| dispatch_once(&Static.onceToken) { | |
| Static.instance = MyClass() | |
| } |
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
| sudo scutil --set HostName name | |
| sudo scutil --set ComputerName name | |
| scutil --get ComputerName | |
| scutil --get HostName |
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
| extension Optional { | |
| public var hasValue: Bool { | |
| return (self != 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
| for parent in self.navigationController!.navigationBar.subviews { | |
| for childView in parent.subviews { | |
| if(childView is UIImageView) { | |
| childView.removeFromSuperview() | |
| } | |
| } | |
| } |
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 | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { | |
| self.window = UIWindow(frame: UIScreen.mainScreen().bounds) |
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
| #include <dlfcn.h> | |
| #include <stdarg.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include "fishhook.h" | |
| int slient_fprintf(FILE * restrict stream, const char * restrict format, ...) | |
| { | |
| if (strncmp(format, "AssertMacros:", 13) == 0) | |
| { |
NewerOlder