This file contains hidden or 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 UI_USER_INTERFACE_IDIOM() | |
| #define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
| #else | |
| #define IS_IPAD() (false) | |
| #endif | |
| #import "UiUtil.h" | |
| @implementation UiUtil |
This file contains hidden or 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
| # /bin/bash | |
| #Usage: $ ./cs_xproj_validate.sh path/to/xcode/project/file/theproject.xcodeproj | |
| #More info: http://stackoverflow.com/q/13962341/89035 | |
| PROJECT_FILE="$1/project.pbxproj" | |
| PREVIOUS_LINE=-1 | |
| for LINE in `cat "$PROJECT_FILE" | grep -n CODE_SIGN_IDENTITY | grep -o -E '^([0-9]*)'` |
This file contains hidden or 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
| // http://cocoawithlove.com/2009/10/ugly-side-of-blocks-explicit.html has a nice breakdown of the syntax--it helps to think of the ^ as similar to a pointer dereference symbol * | |
| // block typedef: | |
| typedef void(^Block)(); | |
| typedef void(^ConditionalBlock)(BOOL); | |
| typedef NSString*(^BlockThatReturnsString)(); | |
| typedef NSString*(^ConditionalBlockThatReturnsString)(BOOL); | |
| // block property with typedef: |
This file contains hidden or 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
| // Eliminar elementos duplicados en un NSArray | |
| NSArray *cleanedArray = [[NSSet setWithArray:dates] allObjects]; |
This file contains hidden or 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
| // http://objective-c.es/modern-objective-c-enum/ | |
| // http://nshipster.com/ns_enum-ns_options/ | |
| typedef NS_ENUM(NSUInteger, GBDaysOfWeek) { | |
| GBSunday, | |
| GBMonday, | |
| GBTuesday, | |
| GBWednesday, | |
| GBThursday, | |
| GBFriday, |
This file contains hidden or 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 <UIKit/UIKit.h> | |
| #define ApplicationDelegate ((QBKAppDelegate *)[UIApplication sharedApplication].delegate) | |
| @interface QBKAppDelegate : UIResponder <UIApplicationDelegate> | |
| @property (strong, nonatomic) UIWindow *window; | |
| @property (copy, nonatomic) NSString* unaCadena; | |
| @end |
This file contains hidden or 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
| //http://mobiledevelopertips.com/core-services/create-universally-unique-identifier-uuid-the-ios-6-way.html | |
| //The class NSUUID implements RFC 4122 creating values that are 128 bits long and guaranteed to be unique across space and time by using a unique value on the device as well as a value representing the elapsed time since October 15, 1582 at 00:00:00. | |
| // iOS 6 | |
| NSUUID *uuid = [NSUUID UUID]; | |
| NSLog(@"UUID: %@", [uuid UUIDString]); | |
| // Output: UUID: A84AFC3C-B3A7-31C7-B3E9-234AF423C6B1 |
This file contains hidden or 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
| # http://mobiledevelopertips.com/core-services/read-info-plist-key-value-pairs.html | |
| NSNumber *prefSet = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"PreferencesSet"]; | |
| NSLog(@"PreferencesSet: %@", prefSet); | |
| NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; | |
| NSLog(@"CFBundleVersion: %@", version); | |
| NSArray *customURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleURLTypes"]; | |
| debug(@"Custom URL: %@", customURL); |
This file contains hidden or 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
| // http://mobiledevelopertips.com/debugging/print-cgrect-and-cgpoint-using-nslog.html | |
| struct CGPoint { | |
| CGFloat x; | |
| CGFloat y; | |
| }; | |
| typedef struct CGPoint CGPoint; | |
| struct CGRect { | |
| CGPoint origin; |
This file contains hidden or 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
| SELECT email, COUNT(email) as total_registros | |
| FROM clientes | |
| GROUP BY email | |
| HAVING COUNT(email)>1 | |
| # http://webintenta.com/seleccionar-registros-repetidos-en-mysql.html | |
| # Consulta SQL que nos permite seleccionar una serie de registros repetidos de un campo e-mail, nif o cualquiero otro campo que debería ser único en nuestra tabla. En el siguiente ejemplo se ha consultado la tabla "clientes" para seleccionar los correos electrónicos repetidos y la cantidad de veces que aparecen en la tabla. |