Skip to content

Instantly share code, notes, and snippets.

View jlcampana's full-sized avatar
:octocat:
emu emu emu...

Jose Luis Campaña jlcampana

:octocat:
emu emu emu...
View GitHub Profile
@jlcampana
jlcampana / ASI HTTP Request + JSON Sample
Created August 7, 2012 13:02
ASI HTTP Request + JSON Sample
ASIHTTPRequest *req = [ASIHTTPRequest requestWithURL:URL];
req.delegate = self;
req.userInfo = [NSDictionary dictionaryWithObject:@"initialRequest" forKey:@"type"];
NSData *body = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
[req appendPostData:body];
[req startSynchronous];
@jlcampana
jlcampana / gist:3246356
Created August 3, 2012 09:49
Dismiss keyboard
[self.view endEditing:YES];
@jlcampana
jlcampana / gist:3246089
Created August 3, 2012 08:57
Crear identificativo único para el dispositivo
- (NSString *)createUUID
{
// Create universally unique identifier (object)
CFUUIDRef uuidObject = CFUUIDCreate(kCFAllocatorDefault);
// Get the string representation of CFUUID object.
NSString *uuidStr = [(NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuidObject) autorelease];
// If needed, here is how to get a representation in bytes, returned as a structure
// typedef struct {
@jlcampana
jlcampana / gist:3245376
Created August 3, 2012 07:26
Network activity
_netRequests--;
if(_netRequests == 0) [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
@jlcampana
jlcampana / runtime_check_ios5
Created January 20, 2012 10:18
Runtime check for iOS5
+(BOOL)deviceIsRunningOS5
{
UIScreen *s = [UIScreen mainScreen];
return [s respondsToSelector:@selector(brightness)];
}