Skip to content

Instantly share code, notes, and snippets.

@DenTelezhkin
DenTelezhkin / gist:beab675d853fcd2fd464
Created July 22, 2014 15:02
Multipart-form PUT request for image upload. NSURLSession, iOS 7
+(void)uploadUserPhoto:(UIImage *)image
success:(void (^)(void))success
failure:(FailureBlock)failure
{
GTSessionManager * manager = [GTSessionManager manager];
NSString* tmpFilename = [NSString stringWithFormat:@"%f", [NSDate timeIntervalSinceReferenceDate]];
NSURL* tmpFileUrl = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:tmpFilename]];
NSString * query = [NSString stringWithFormat:@"%@user?auth_token=%@",[manager.baseURL absoluteString],[[UserManager shared] authToken]];
@DenTelezhkin
DenTelezhkin / NetworkingTest.m
Created March 25, 2014 15:59
Testing networking with OHHTTPStubs and Expecta
@interface BitcoinLoaderSpecs : XCTestCase
@property (nonatomic, strong) RateModel * rate;
@end
@implementation BitcoinLoaderSpecs
- (void)setUp
{
[super setUp];
@DenTelezhkin
DenTelezhkin / README.md
Last active July 11, 2016 09:19
CI Rakefile for iOS applications.Prerequisites: xcpretty, shenzhen, cocoapods, testflight, XCTest.Put this Rakefile into directory with your .xcodeproj and run rake. Remove build tasks you don't need in your setup.

Usage

Install dependencies and run tests

rake 

Dependencies, tests, archive in Release configuration and upload to TestFlight

rake testflight 
@DenTelezhkin
DenTelezhkin / main.m
Last active December 26, 2015 23:19
Running XCTests without creating any of application controllers.
static bool isRunningTests()
{
NSDictionary* environment = [[NSProcessInfo processInfo] environment];
NSString* injectBundle = environment[@"XCInjectBundle"];
return [[injectBundle pathExtension] isEqualToString:@"xctest"];
}
int main(int argc, char *argv[])
{
@autoreleasepool