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
# define ALog(format, ...) NSLog((@"%s [L%d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); | |
# ifdef DEBUG | |
# define DLog(format, ...) ALog(format, ##__VA_ARGS__); | |
# else | |
# define DLog(...) | |
# endif |
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
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); | |
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"Internet-Jen-1117" ofType:@"wav"]; | |
SystemSoundID soundID; | |
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath: soundPath], &soundID); | |
AudioServicesPlaySystemSound (soundID); | |
[soundPath 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
ImagePicker = [[UIImagePickerController alloc] init]; | |
ImagePicker.delegate = self; | |
#if TARGET_IPHONE_SIMULATOR | |
ImagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; | |
#elif TARGET_OS_IPHONE | |
ImagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; | |
UIImageView *ImgOutline=[[UIImageView alloc] initWithFrame:CGRectMake(20, 28, 124, 404)]; | |
ImgOutline.image=[UIImage imageNamed:@"outline.png"]; | |
[ImagePicker.view addSubview:ImgOutline]; | |
#endif |
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
UIActionSheet *msg = [[[UIActionSheet alloc] | |
initWithTitle:@"Lorem ipsum dolor...text goes here" | |
delegate:nil | |
cancelButtonTitle:nil destructiveButtonTitle:nil | |
otherButtonTitles:@"Okay", nil] | |
autorelease]; | |
[msg showInView:window]; |
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
ContentValues values = new ContentValues(); | |
values.put("address", "+550012345678"); | |
values.put("body", "Parabens!"); | |
getContentResolver().insert(Uri.parse("content://sms/sent"),values); | |
values.put("address", "+550012345678"); | |
values.put("body", "Mais um Teste"); | |
getContentResolver().insert(Uri.parse("content://sms/sent"),values); | |
values.put("address", "+550012345678"); |
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 *)intToBinary:(int)number | |
{ | |
// Number of bits | |
int bits = sizeof(number) * 8; | |
// Create mutable string to hold binary result | |
NSMutableString *binaryStr = [NSMutableString string]; | |
// For each bit, determine if 1 or 0 | |
// Bitwise shift right to process next number |
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
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
// Debug | |
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
#define DEBUG_ON // Toggle to DEBUG_OFF to hide all debug code | |
#ifdef DEBUG_ON | |
#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]); | |
#else | |
#define debug(format, ...) | |
#endif |
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
#ifdef __OBJC__ | |
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
#import <QuartzCore/QuartzCore.h> | |
#import "TestFlight.h" | |
#endif | |
// Debug | |
#ifdef DEBUG | |
# define DLog(...) NSLog(__VA_ARGS__) |
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
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); | |
dispatch_async(queue, ^{ | |
NSError *error = nil; | |
NSURL *url = [NSURL URLWithString:@"http://brandontreb.com/apps/pocket-mud-pro/promo.json"]; | |
NSString *json = [NSString stringWithContentsOfURL:url | |
encoding:NSASCIIStringEncoding | |
error:&error]; | |
NSLog(@"\nJSON: %@ \n Error: %@", json, error); | |
}); |
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
if(!error) { | |
NSData *jsonData = [json dataUsingEncoding:NSASCIIStringEncoding]; | |
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData | |
options:kNilOptions | |
error:&error]; | |
NSLog(@"JSON: %@", jsonDict); | |
} | |
NSString *promo_url = [jsonDict objectForKey:@"promo_url"]; |
OlderNewer