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
#import "EGOCache.h" | |
@interface EGOCache (NSArray) | |
- (void)setArray:(NSArray*)array forKey:(NSString*)key; | |
- (void)setArray:(NSArray*)array forKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval; | |
- (NSArray*)arrayForKey:(NSString*)key; | |
@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
public static int getTextHeight(String text, int maxWidth, float textSize, Typeface typeface) { | |
TextPaint paint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); | |
paint.setTextSize(textSize); | |
paint.setTypeface(typeface); | |
int lineCount = 0; | |
int index = 0; | |
int length = text.length(); |
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
<?php | |
while(TRUE) { | |
$contents = @file_get_contents("http://store.apple.com/"); | |
if(strpos($contents, "backsoon") != FALSE) { | |
exec("osascript -e 'tell app \"System Events\" to display dialog \"Apple Store appears to be up.\"'"); | |
exit; | |
} else { | |
sleep(5); | |
} |
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
#import <UIKit/UIKit.h> | |
@interface UIImage (Resizing) | |
- (UIImage*)scaleToSize:(CGSize)size; | |
@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)someMethod { | |
UIImage* scaledImage = [[UIImage imageNamed:@"largeImage"] scaleToSize:CGSizeMake(100.0f, 100.0f); | |
} |
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
#import <UIKit/UIKit.h> | |
@interface UIDevice (AvailableMemory) | |
- (double)availableMemory; | |
@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)someMethod { | |
NSLog(@"Available Memory: %f", [[UIDevice currentDevice] availableMemory]); | |
} |
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
# Disable Access to .svn directories | |
RewriteRule \.svn - [F] | |
# Disable Access to .git directories | |
RewriteRule \.git - [F] |
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
# Disable Access to .svn directories | |
$HTTP["url"] =~ "\.svn" { | |
url.access-deny = ("") | |
} | |
# Disable Access to .git directories | |
$HTTP["url"] =~ "\.git" { | |
url.access-deny = ("") | |
} |
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
EGODatabase* database = [EGODatabase databaseWithPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/database.db"]]; | |
EGODatabaseResult* result = [database executeQuery:@"SELECT * FROM `posts` WHERE `post_user_id` = ?", [NSNumber numberWithInt:10]]; | |
for(EGODatabaseRow* row in result) { | |
NSLog(@"Subject: %@", [row stringForColumn:@"post_subject"]); | |
NSLog(@"Date: %@", [row dateForColumn:@"post_date"]); | |
NSLog(@"Views: %d", [row intForColumn:@"post_views"]); | |
NSLog(@"Message: %@", [row stringForColumn:@"post_message"]); | |
} |
OlderNewer