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
// totally works! | |
[UIView animateWithDuration:0.5 | |
delay:0 | |
usingSpringWithDamping:.5 | |
initialSpringVelocity:1 | |
options:0 | |
animations:^{ | |
CGRect bounds = self.scrollview.bounds; | |
bounds.origin = CGPointZero; | |
self.scrollview.bounds = bounds; |
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
// I'm a bad person | |
var loc = window.location.hash; | |
if (loc.length > 0) | |
{ | |
loc = loc.substr(1); | |
if (typeof window[loc] === "function") | |
window[loc](); | |
} |
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
Many people are not homophobic, they're simply echoing the homophobic social pressures around them. Showing support at the very least lets people know they're not alone and that it's okay to speak out. | |
This is particularly important for younger people. | |
(That said, I do my part to support equality offline, too) |
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
Test 0: | |
Manual Time: 0.001s | |
Built In Time: 0s | |
Test 1: | |
Manual Time: 0s | |
Built In Time: 0s | |
Test 2: | |
Manual Time: 0.003s | |
Built In Time: 0s | |
Test 3: |
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
@implementation Foo : Bar | |
{ | |
id foo; | |
id x; | |
} | |
- (void)setFoo:(id)foo | |
{ | |
var blah = foo; | |
foo = blah; |
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
retainedSelf = self; |
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 *)scrollView | |
{ | |
const CGFloat threshHold = -60.0f; | |
const float minOpacity = 0.2; | |
CGFloat currentOffset = [scrollView contentOffset].x; | |
if (currentOffset < 0.0) | |
{ | |
CGFloat currentProgress = currentOffset / threshHold; | |
[scrollView setAlpha:MAX(1.0 - (1.0 * currentProgress), minOpacity)]; |
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
@implementation VerticalLayoutView : CPView | |
{ | |
double gapBetweenViews; | |
} | |
- (void)setGapBetweenViews:(double)aGap | |
{ | |
gapBetweenViews = aGap; | |
} |
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
NSString *localDateString = [NSDateFormatter dateFormatFromTemplate:@"MdY" options:0 locale:[NSLocale currentLocale]]; | |
NSCharacterSet *validChars = [NSCharacterSet letterCharacterSet]; | |
NSInteger i = 0; | |
NSMutableString *newString = [NSMutableString stringWithCapacity:5]; | |
while (i < [localDateString length]) | |
{ | |
char charatcter = [localDateString characterAtIndex:i]; | |
static NSString *appendChar = @"%c"; |
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
/** | |
Goal: have a properly localized date (month/day in the correct order), yet | |
have a custom date component separator. | |
Example as follows: | |
*/ | |
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; | |
NSLocale *gbLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"]; | |
NSLocale *deLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"de_DE"]; |
NewerOlder