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
# For Django in the root folder | |
find . -name '*.py' | xargs wc -l | |
# For Angular, in the ROOT/src/app folder | |
find . -name '*.ts' | xargs wc -l |
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
- (void)textViewDidChange:(UITextView *)textView { | |
[self _showTextViewCaretPosition:textView]; | |
} | |
- (void)textViewDidChangeSelection:(UITextView *)textView { | |
[self _showTextViewCaretPosition:textView]; | |
} | |
- (void)_showTextViewCaretPosition:(UITextView *)textView { |
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
@interface TRHLinkedNode : NSObject | |
@property (nonatomic, strong) NSString *dogName; | |
@property (nonatomic, string) TRHLinkedNode *nextNode; | |
- (void)appendItemToEnd(TRHLinkedNode *)item; | |
+ (void)searchAndDeleteFromLinkedList:(NSString *)dog afterItem:(TRHLinkedNode)headNode; | |
@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
/* Sometimes in iOS 7, a UITextView will be invisible until the user starts editing it or | |
the keyboard appears. Adding this somewhere after setup will fix this issue (either viewDidLoad or viewDidLayoutSubviews) | |
*/ | |
[self.textView.layoutManager ensureLayoutForTextContainer:self.textView.textContainer]; |
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
// Requires UIColor+FlatUI.h from Grouper/FlatUIKit | |
static inline CGFloat skRandf() { | |
return rand() / (CGFloat) RAND_MAX; | |
} | |
static inline CGFloat skRand(CGFloat low, CGFloat high) { | |
return skRandf() * (high - low) + low; | |
} |
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
// Get a random capitol letter | |
[NSString stringWithFormat:@"%c", arc4random_uniform(26) + 'A']; | |
//...or lowercase | |
[NSString stringWithFormat:@"%c", arc4random_uniform(26) + 'a']; |
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
# | |
# As far as I can tell, iOS treats fontSize based on PPI. It's not completely perfect but here is a good ratio to use. | |
# Spoiler: It's 2.591 | |
# | |
+(CGFloat)getFontSizeFromIPadFontSize:(CGFloat)fontSize { | |
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) { | |
fontSize = fontSize / 2.591; | |
} | |
return fontSize; |
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
// THGridMenuItem+ProjectItem.h | |
#import "THGridMenuItem.h" | |
#import "Project.h" | |
@interface THGridMenuItem (ProjectItem) | |
@property (nonatomic, strong) Project *project; | |
-(Project *)project; | |
-(void)setProject:(Project *)project; |
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
+(CGPoint)getViewRealCenter:(UIView *)view { | |
CGPoint realCenter; | |
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; | |
realCenter = UIInterfaceOrientationIsLandscape(orientation) ? CGPointMake(view.center.y, view.center.x) : view.center; | |
return realCenter; | |
} |
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
+(CGFloat)getRealDeviceWidth { | |
CGFloat deviceWidth; | |
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; | |
if(UIInterfaceOrientationIsLandscape(orientation)) { | |
deviceWidth = [UIScreen mainScreen].bounds.size.height; | |
} else { | |
deviceWidth = [UIScreen mainScreen].bounds.size.width; | |
} | |
return deviceWidth; | |
} |