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
defaults write com.apple.finder QLEnableTextSelection -bool true | |
killall Finder |
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
while true; do if `curl -m 15 https://developer.apple.com/devcenter/ios/index.action | grep -v --quiet "maintenance"`; then say "dev center is back online"; fi; sleep 60; done |
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
// Original w/branching | |
float result; | |
if(varA < varB) | |
{ | |
result=100.0; | |
} | |
else | |
{ | |
result=32.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
- (void)scrollViewDidScroll:(UIScrollView *)sender { | |
BOOL isScrollingRight = _scrollView.contentOffset.x > _previousContentOffsetX; | |
_mostRecentScrollWasRight = isScrollingRight; | |
_previousContentOffsetX = _scrollView.contentOffset.x; | |
CGFloat pageWidth = _scrollView.frame.size.width; | |
int scrollingToPageNum = isScrollingRight ? (ceil((_scrollView.contentOffset.x - pageWidth) / pageWidth) + 1) : (floor((_scrollView.contentOffset.x -pageWidth) / pageWidth) + 1); | |
int percentOfScrollToPageOnscreen = isScrollingRight ? floor((((int)_scrollView.contentOffset.x % (int)pageWidth) / pageWidth)*100) |
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
// keyTimes = array floats for second [(NSNumber)1.2,(NSNumber)2.0] == 2 frames, 1.2 secs for first frame, 2.0 seconds for second frame | |
- (void) addDiscreteTimedImageAnimation:(NSString *)animationName view:(UIImageView *)imageView images:(NSArray *)images keyTimes:(NSArray *)keyTimes repeatCount:(float)repeatCount onDone:(SEL)callback { | |
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"]; | |
NSMutableArray *values = [[NSMutableArray alloc] initWithCapacity:[images count]]; | |
NSMutableArray *keyTimesAsPercent = [[NSMutableArray alloc] initWithCapacity:[keyTimes count]]; | |
double totalDuration = 0.0; | |
for(UIImage *image in images) { | |
[values addObject:(id)(image.CGImage)]; | |
} |
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
notes from the web on better debug breakpoints in xcode | |
Run > Manage Breakpoints > Add Symbolic Breakpoint | |
add a breakpoint called "objc_exception_throw" | |
Create a file named .gdbinit and place it in your home directory. This is the contents of mine: | |
fb -[NSException raise] | |
fb -[_NSZombie release] |