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
@implementation UINavigationBar (CustomImage) | |
- (void)drawRect:(CGRect)rect { | |
UIImage *image = [UIImage imageNamed: NAVIGATION_BAR_BACKGROUND]; | |
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; | |
} | |
@end | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
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 <iostream> | |
class MyObject { | |
public: | |
int x; | |
}; | |
void object_by_value_modify_member(MyObject o) { | |
o.x = 20; |
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 <iostream> | |
class Objeto { | |
public: | |
int x; | |
}; | |
void objeto_por_valor_modificar_miembro(Objeto o) { | |
o.x = 20; |
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
UIBackgroundTaskIdentifier bgTask; | |
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ | |
[app endBackgroundTask:bgTask]; | |
}]; | |
self.updateLocationTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_INTERVAL target:self selector:@selector(shouldStartLocationUpdate) userInfo:nil repeats:YES]; |
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
+ (float_t) batteryLevel { | |
UIDevice *myDevice = [UIDevice currentDevice]; | |
[myDevice setBatteryMonitoringEnabled:YES]; | |
return [myDevice batteryLevel]; | |
} |
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
/* | |
UNIQUE IDENTIFIER | |
*/ | |
+ (NSString*) deviceIdentifier { | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
NSString *deviceId = [defaults objectForKey:DEVICE_ID_KEY]; | |
if (!deviceId) { | |
//Create unique ID | |
CFUUIDRef newUniqueId = CFUUIDCreate(kCFAllocatorDefault); |
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
+ (NSString *)getMacAddress | |
{ | |
int mgmtInfoBase[6]; | |
char *msgBuffer = NULL; | |
size_t length; | |
unsigned char macAddress[6]; | |
struct if_msghdr *interfaceMsgStruct; | |
struct sockaddr_dl *socketStruct; | |
NSString *errorFlag = NULL; | |
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
+(BOOL) loadSession { | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
if (![defaults objectForKey:ACCESS_TOKEN_KEY] || | |
![defaults objectForKey:EXPIRATION_DATE_KEY] || | |
![defaults objectForKey:FACEBOOK_USER]) { | |
[Util clearSession]; | |
return NO; | |
} | |
Facebook *facebook = [[Util sharedInstance] facebook]; |
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) publishToFacebook:(NSData*)image withMessage:(NSString*)message { | |
NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; | |
[params setValue:message forKey:@"message"]; | |
[params setValue:image forKey:@"source"]; | |
[[[Util sharedInstance] facebook] requestWithGraphPath:@"me/photos" | |
andParams:params | |
andHttpMethod:@"POST" | |
andDelegate:self]; | |
[params release]; | |
} |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; | |
UITabBarController *tbc = [[UITabBarController alloc] init]; | |
UINavigationController *nvc = [[UINavigationController alloc] init]; | |
StreamViewController *vc = [[StreamViewController alloc] init]; | |
vc.title = @"Vampire Or Not"; | |
[nvc pushViewController:vc animated:NO]; |