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
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
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
// Feel free to use. MIT License | |
#import <Foundation/Foundation.h> | |
#import "cocos2d.h" | |
// Layer that will just capture any touch events on it | |
@interface OpaqueLayer : CCLayerColor { | |
} |
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
@interface UIImage (fixOrientation) | |
- (UIImage *)fixOrientation; | |
@end |
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 UIView (NibLoadingExtension) | |
+ (id)viewFromNib | |
{ | |
static NSMutableDictionary *caches = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
caches = [[NSMutableDictionary dictionary] retain]; | |
}); |
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
-(CGRect) fullBoundingBox | |
{ | |
NSMutableArray *stack = [[NSMutableArray new] autorelease]; | |
for (CCNode *childNode in self.children) | |
{ | |
[stack addObject:childNode]; | |
} | |
float leftmost, highest, rightmost, lowest; | |
while ([stack count] > 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
[UIView beginAnimations:@"FlipAnimation" context:nil]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:myFirstDrillDownView cache:NO]; | |
[UIView setAnimationBeginsFromCurrentState:YES]; | |
[myFirstDrillDownView exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; | |
[UIView commitAnimations]; |
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
@interface MoonPhase : NSObject { | |
@private | |
NSDate *now; | |
} | |
- (float) phase; | |
@end | |
// --------------------------------------- |
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)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { | |
[self.view removeFromSuperview]; | |
} | |
-(void) dismiss { | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.3f]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; | |
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
// | |
// AutoEncoder.h | |
// QuartzTest | |
// | |
// Created by Alex Wiltschko on 6/27/11. | |
// Copyright 2011 __MyCompanyName__. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
// Accessorizer's default generated singleton code for class Foo | |
static Foo *sharedInstance = nil; | |
+ (void) initialize | |
{ | |
if (sharedInstance == nil) | |
sharedInstance = [[self alloc] init]; | |
} |