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
# 1. Use Celery: | |
# http://celery.readthedocs.org/en/latest/tutorials/debugging.html | |
from celery import task | |
from celery.contrib import rdb | |
@task() | |
def add(x, y): | |
result = x + y | |
rdb.set_trace() # <- set breakpoint |
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
from PIL import Image | |
img = Image.open("imagefilename.png") | |
print img.size | |
# 512, 512 | |
print img.format | |
# PNG | |
print img.mode | |
# RGB |
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)viewDidLoad | |
{ | |
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, 20); | |
UIView *statusBarBg = [[UIView alloc] initWithFrame:rect]; | |
[self.view addSubview:statusBarBg]; | |
statusBarBg.backgroundColor = [UIColor purpleColor]; | |
} | |
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 <Foundation/Foundation.h> | |
@interface BouncyTransition : NSObject <UIViewControllerAnimatedTransitioning> | |
@end |
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
@interface RootVC : UIViewController <UIViewControllerTransitioningDelegate> |
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
@interface InteractiveTransition.h : NSObject <UIViewControllerAnimatedTransitioning> | |
@end |
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
@property (strong, nonatomic) UIDynamicAnimator *animator; | |
@property (strong, nonatomic) UIView *boxView; |
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
@interface RootVC : UIViewController <UIDynamicAnimatorDelegate> | |
@property (strong, nonatomic) UIDynamicAnimator *animator; | |
@property (strong, nonatomic) UIView *noticeView; |
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
NSDictionary *dict = responseObject; | |
NSLog(@"dict"); | |
for (id key in dict) { | |
id obj = [dict objectForKey:key]; | |
NSLog(@"key=%@ value=%@ class=%@", key, obj, [obj class]); | |
} |
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
// http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices | |
#define IS_IPHONE ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPhone" ] ) | |
#define IS_IPHONE_4 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )480 ) < DBL_EPSILON ) | |
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) | |
#define IS_IPHONE_6 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )667 ) < DBL_EPSILON ) | |
#define IS_IPHONE_6_PLUS ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )736 ) < DBL_EPSILON ) |
OlderNewer