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
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"]; |
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
echo "Hi, I'm Douglas Crockford. What do you want?"; | |
while read question | |
do | |
what="$question" | |
if [ -z "${what}" ]; then | |
echo "Stop waisting my time." | |
exit | |
else |
NewerOlder