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
self.view.backgroundColor = loggedIn ? [UIColor greenColor] : [UIColor redColor]; |
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)startAnimation | |
{ | |
self.imageViewHigh.hidden = NO; | |
CABasicAnimation *theAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; | |
theAnimation.duration = 1.0f; | |
theAnimation.repeatCount = HUGE_VALF; | |
theAnimation.autoreverses = YES; | |
theAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; | |
theAnimation.toValue = [NSNumber numberWithFloat:1.0f]; | |
[self.imageViewHigh.layer addAnimation:theAnimation forKey:@"animateOpacity"]; |
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
static CGSize scrollSize; // set on viewDidLoad | |
- (CGRect)frameForPosition:(int)pos | |
{ | |
float x = pos * scrollSize.width; | |
float y = 0; | |
float width = scrollSize.width; | |
float height = scrollSize.height; | |
return CGRectMake (x, y, width, height); |
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
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" |
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)appendStringOrEmpty:(NSString*)string{ | |
if (string) { | |
[self appendString:string]; | |
} else { | |
[self appendString:@""]; | |
} | |
} |
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
+ (UIImage *)imageFromView:(UIView *)view | |
{ | |
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { | |
if ([[UIScreen mainScreen] scale] == 2.0) { | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 2.0); | |
} else { | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 1.0); | |
} | |
} else { | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 1.0); |
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
// the following snippet sets the number of lines to 1 | |
myTextView.attributedText = [[NSAttributedStringalloc] initWithString:@"my too long text"]; | |
myTextView.textContainer.maximumNumberOfLines = 1; | |
myTextView.textContainer.lineBreakMode = NSLineBreakByTruncatingTail; |
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
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad |
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
let layer = view.layer | |
layer.cornerRadius = CGRectGetWidth(mapView.bounds) / 2 | |
layer.borderWidth = 1 | |
layer.masksToBounds = true |
OlderNewer