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
dispatch_queue_t queue = dispatch_queue_create("PlusFlickrPhotoView Queue", DISPATCH_QUEUE_CONCURRENT); | |
dispatch_async(queue, ^{ | |
// force decompress of image | |
UIGraphicsBeginImageContext(CGSizeMake(1, 1)); | |
[image drawAtPoint:CGPointZero]; | |
UIGraphicsEndImageContext(); | |
// set the image on main thread | |
dispatch_sync(dispatch_get_main_queue(), ^{ |
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
int test(int a, int b, int c, int d, int e) | |
{ | |
if ((a*b) != 24) return 0; | |
if (d != (b/2)) return 0; | |
if ((a+c)!=(d+e)) return 0; | |
if ((a+b+c+d+e) != 26) return 0; | |
// count occurences of digits | |
int counts[10] = {0,0,0,0,0,0,0,0,0,0}; | |
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)keyboardWillShow:(NSNotification *)notification | |
{ | |
NSArray *appWindows = [[UIApplication sharedApplication] windows]; | |
UIWindow *keyboardWindow = [appWindows lastObject]; | |
UIView *keyboardView = [keyboardWindow.subviews objectAtIndex:0]; | |
keyboardView = [keyboardView.subviews objectAtIndex:0]; | |
keyboardView = [keyboardView.subviews objectAtIndex:0]; | |
keyboardView = [keyboardView.subviews objectAtIndex:0]; | |
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)addShadowWithColor:(UIColor *)color alpha:(CGFloat)alpha radius:(CGFloat)radius offset:(CGSize)offset | |
{ | |
self.layer.shadowOpacity = alpha; | |
self.layer.shadowRadius = radius; | |
self.layer.shadowOffset = offset; | |
if (color) | |
{ | |
self.layer.shadowColor = [color CGColor]; | |
} |
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
// UIImageJPEGRepresentation | |
NSData *data = UIImageJPEGRepresentation(tileImage, 0.71); | |
[data writeToURL:cacheURL atomically:YES]; | |
// ImageIO | |
#import <ImageIO/ImageIO.h> | |
#import <MobileCoreServices/UTCoreTypes.h> |
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
long l = 1078768689; | |
// dosdate spec: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724247(v=vs.85).aspx | |
int year = ((l>>25)&127) + 1980; // 7 bits | |
int month = (l>>21)&15; // 4 bits | |
int day = (l>>16)&31; // 5 bits | |
int hour = (l>>11)&31; // 5 bits | |
int minute = (l>>5)&63; // 6 bits | |
int second = (l&31) * 2; // 5 bits |
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
// | |
// DTAsyncFileDeleter.m | |
// DTFoundation | |
// | |
// Created by Oliver Drobnik on 2/10/12. | |
// Copyright (c) 2012 Cocoanetics. All rights reserved. | |
// | |
#import "DTAsyncFileDeleter.h" |
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
mkdir gh-pages | |
cd gh-pages | |
git init | |
git remote add origin [email protected]:Cocoanetics/DTWebArchive.git | |
git symbolic-ref HEAD refs/heads/gh-pages | |
# add and commit files | |
git push origin gh-pages |
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
// | |
// NSURL+DTAppLinks.h | |
// DTFoundation | |
// | |
// Created by Oliver Drobnik on 11/25/11. | |
// Copyright (c) 2011 Cocoanetics. All rights reserved. | |
// | |
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)animationDidStop:(CABasicAnimation *)anim finished:(BOOL)flag | |
{ | |
self.layer.shadowPath = (CGPathRef)anim.toValue; | |
} | |
- (void)updateShadowWithDuration:(NSTimeInterval)duration | |
{ | |
CALayer *layer = self.layer; | |
if (_dropShadow) |