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
/** | |
* Wait for [AssestLibrary enumerateGroupsWithTypes: usingBlock:] to be completed, or how other | |
* people call it, [AssestLibrary enumerateGroupsWithTypes: usingBlock:] Asynchronous | |
* The following method should not be called on main thread, use | |
* [self performSelectorInBackground:@selector(getAllAssets) withObject:nil]; | |
* to excecute it | |
*/ | |
- (void)getAllAssets |
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
//Milisegundos a días, horas, minutos y segundos en javascript | |
var x = difference / 1000 | |
seconds = x % 60 | |
x /= 60 | |
minutes = x % 60 | |
x /= 60 | |
hours = x % 24 | |
x /= 24 | |
days = x; |
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
//Muchas veces los permisos de internet en el AndroidManifest.xml no son sufucientes. | |
//Si en el emulador los webservices remotos funcionan bien, peron en el dispositivo real retornan null, | |
//es posible que se necesit configurar esto: | |
//nota: hay que colocar esto encima de la declaracion de la clase: | |
//@TargetApi(Build.VERSION_CODES.GINGERBREAD) | |
if (android.os.Build.VERSION.SDK_INT > 9) { | |
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); |
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
//Update each midnight | |
NSCalendar *cal = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease]; | |
[cal setTimeZone:[NSTimeZone systemTimeZone]]; | |
NSDateComponents * comp = [cal components:( NSYearCalendarUnit| NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit) fromDate:[NSDate date]]; | |
[comp setMinute:0]; | |
[comp setHour:0]; | |
NSDate *startOfToday = [cal dateFromComponents:comp]; |
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
#import "ViewController.h" | |
#import "JSONKit.h" | |
@interface ViewController () | |
@property (nonatomic, retain) NSMutableData *response; | |
@end | |
@implementation ViewController |