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
#!/bin/sh | |
# Adapted from http://furbo.org/2009/03/03/open-sesame/ | |
if [ -z "$1" ]; then | |
echo "usage: $0 <app> [ Preferences | <document> ]" | |
else | |
app=`ls -1td ~/Library/Application\ Support/iPhone\ Simulator/User/Applications/*/$1.app | head -1` | |
dir=`dirname "$app"` | |
if [ "$2" = "Preferences" ]; then |
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
<?php | |
/** | |
* Cast an object into a different class. | |
* | |
* Currently this only supports casting DOWN the inheritance chain, | |
* that is, an object may only be cast into a class if that class | |
* is a descendant of the object's current class. | |
* | |
* This is mostly to avoid potentially losing data by casting across | |
* incompatable classes. |
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
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |
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
// method to calculate a standard md5 checksum of this string, check against: http://www.adamek.biz/md5-generator.php | |
- (NSString * )md5 | |
{ | |
const char *cStr = [self UTF8String]; | |
unsigned char result [CC_MD5_DIGEST_LENGTH]; | |
CC_MD5( cStr, strlen(cStr), result ); | |
return [NSString | |
stringWithFormat: @"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", | |
result[0], result[1], |
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) |
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
// DictionaryTypesHelper.h | |
#import <Foundation/Foundation.h> | |
@interface NSDictionary (NSDictionary_DictionaryTypesHelper) | |
- (NSArray*)arrayForKey:(id)key; | |
- (NSDictionary*)dictionaryForKey:(id)key; | |
- (NSString*)stringForKey:(id)key; | |
- (NSNumber*)numberForKey:(id)key; | |
- (NSData*)dataForKey:(id)key; |
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
/* Original source code courtesy John from iOSDeveloperTips.com */ | |
#include <sys/socket.h> | |
#include <sys/sysctl.h> | |
#include <net/if.h> | |
#include <net/if_dl.h> | |
+ (NSString *)getMacAddress | |
{ | |
int mgmtInfoBase[6]; |
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
+(BOOL)deviceIsRunningOS5 | |
{ | |
UIScreen *s = [UIScreen mainScreen]; | |
return [s respondsToSelector:@selector(brightness)]; | |
} |
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
BOOL proVersion = YES; | |
if (proVersion) { | |
return; | |
} | |
//create predicate and filter the results | |
NSPredicate *freePredicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *binding) { | |
InAppGame *game = (InAppGame *)evaluatedObject; | |
return game.isFree; | |
}]; |
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> |
OlderNewer