This file contains 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
CLLocationDistance distanceBetweenCoordinates(CLLocationDegrees startLat, CLLocationDegrees startLng, | |
CLLocationDegrees endLat, CLLocationDegrees endLng) | |
{ | |
CLLocation *locA = [[CLLocation alloc] initWithLatitude:startLat | |
longitude:startLng]; | |
CLLocation *locB = [[CLLocation alloc] initWithLatitude:endLat | |
longitude:endLng]; | |
return [locA distanceFromLocation:locB]; |
This file contains 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 <stdio.h> | |
int mul (int a, int b) { | |
int p = 0; | |
while (b) { | |
if ((b&1) == 1) | |
p += a; | |
a <<= 1; | |
b >>= 1; | |
} |
This file contains 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
void uncaughtExceptionHandler(NSException *exception) | |
{ | |
for (id obj in [exception callStackSymbols]) | |
{ | |
printf("%s\n", [obj UTF8String]); | |
} | |
} |
This file contains 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
+ (AVCaptureConnection *)connectionWithMediaType:(NSString *)mediaType fromConnections:(NSArray *)connections | |
{ | |
for ( AVCaptureConnection *connection in connections ) { | |
for ( AVCaptureInputPort *port in [connection inputPorts] ) { | |
if ( [[port mediaType] isEqual:mediaType] ) { | |
return connection; | |
} | |
} | |
} | |
return nil; |