Skip to content

Instantly share code, notes, and snippets.

View hlxwell's full-sized avatar
⛷️
Focusing

Michael He hlxwell

⛷️
Focusing
View GitHub Profile
@hlxwell
hlxwell / new_gist_file
Created April 16, 2013 02:53
Animate from one view to another
[UIView transitionFromView:self.view toView:listsViewController.view
duration:1 options:UIViewAnimationOptionTransitionFlipFromRight
completion:^(BOOL finished) {
[[UIApplication sharedApplication].delegate window].rootViewController = listsViewController;
}];
@hlxwell
hlxwell / new_gist_file
Created April 10, 2013 06:45
Good service for making image placeholder
http://placehold.it/120x100
@hlxwell
hlxwell / new_gist_file
Created April 10, 2013 02:17
transition from view to view
[self transitionFromViewController: toViewController: duration: options: animations: completion];
self.view.transform = xxx
@hlxwell
hlxwell / new_gist_file
Created April 10, 2013 01:34
Number is even or not
number % 2
@hlxwell
hlxwell / new_gist_file
Created April 9, 2013 06:44
count the line of code and exclude some folder
find . ! -wholename '*Vendor*' -name "*.h" -exec cat {} \; | wc -l
@hlxwell
hlxwell / new_gist_file.m
Created April 4, 2013 09:02
CoreData Sort through Relationship
NSSortDescriptor *sortNameDescriptor = [[NSSortDescriptor alloc] initWithKey:@"firstName" ascending:YES];
[company.workers sortedArrayUsingDescriptors:@[sortNameDescriptor]];
@hlxwell
hlxwell / new_gist_file
Created April 4, 2013 02:52
get font size of label
NSString *fontName = self.label.font.fontName;
CGFloat fontSize = self.label.font.pointSize;
@hlxwell
hlxwell / new_gist_file
Created April 3, 2013 09:43
To see how many font names fo one font family
NSLog(@"%@", [UIFont fontNamesForFamilyName:@"Helvetica"]);
@hlxwell
hlxwell / macros.h
Created March 29, 2013 07:24
Macros for iOS
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define CurrentSystemVersion ([[UIDevice currentDevice] systemVersion])
#define CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])
//use dlog to print while in debug model
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
@hlxwell
hlxwell / new_gist_file
Created March 28, 2013 12:25
Delayed execution objective-c
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
//// will be executed after 1 second
});