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
static NSString* const kAWSAccessKey = @"__ACCESS__KEY__"; // From AWS Developer portal | |
static NSString* const kAWSSecretKey = @"__SECRET__KEY__"; // From AWS Developer portal | |
static NSString* const kAWSAssociateTag = @"examp-99"; // Can be a bogus tag in the format xxxxx-XX (x being a letter and X being a number) | |
/* NSString category for HMAC and URL string encoding */ | |
@interface NSString (AWSAdditions) | |
- (NSString*)URLEncodedStringForCharacters:(NSString*)characters; | |
+ (NSData*)HMACSHA256EncodedDataWithKey:(NSString*)key data:(NSString*)data; | |
@end |
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)parse | |
{ | |
NSArray *libraryDatabases = [[[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.apple.iApps"] objectForKey:@"iTunesRecentDatabases"]; | |
NSURL *libraryURL = (([libraryDatabases count])) ? [NSURL URLWithString:[libraryDatabases objectAtIndex:0]] : nil; | |
assert(libraryURL); | |
const char *libPath = [libraryURL.path UTF8String]; | |
const int min = 4; | |
FILE *fp = fopen(libPath, "r"); | |
assert(fp); | |
char buffer[min]; |
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)parse | |
{ | |
NSLog(@"Began parsing"); | |
[inputStream open]; | |
/* Read 4 bytes initially to create the push parser context and begin parsing */ | |
NSStreamStatus status = [inputStream streamStatus]; | |
uint8_t buf[4]; | |
NSInteger bytesRead; | |
while (status != NSStreamStatusAtEnd) { | |
if (status == NSStreamStatusError) { |
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
@implementation NSView (SNRAdditions) | |
- (void)scrollPointAnimated:(NSPoint)point | |
{ | |
NSScrollView *scrollView = [self enclosingScrollView]; | |
NSClipView *clipView = [scrollView contentView]; | |
NSPoint constrainedPoint = [clipView constrainScrollPoint:point]; | |
[NSAnimationContext beginGrouping]; | |
[[NSAnimationContext currentContext] setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; | |
[[clipView animator] setBoundsOrigin:constrainedPoint]; | |
[NSAnimationContext endGrouping]; |
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
CGContextRef ctx = UIGraphicsGetCurrentContext(); // your drawing context | |
CGRect colorRect = CGRectMake(0, 0, 100, 100); // the rect to draw the color overlay into | |
// Set the blend mode to "Normal" | |
// This is the default blend mode setting so this line is not required, shown here for demonstration | |
CGContextSetBlendMode(ctx, kCGBlendModeNormal); | |
// Set the opacity of the drawing context (once again, not required) | |
CGContextSetAlpha(ctx, 1.0); | |
// Create the red color | |
CGColorRef redColor = CGColorCreateGenericRGB(0.908, 0.149, 0.145, 1.000); | |
// Set the fill color of the context and fill the rect |
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
@interface NSString (Additions) | |
- (NSString*)stringByRemovingWhitespace; | |
@property (readonly) NSString *MD5; | |
@end | |
@implementation NSString (Additions) | |
- (NSString*)stringByRemovingWhitespace | |
{ | |
NSCharacterSet *whitespaces = [NSCharacterSet whitespaceCharacterSet]; |
NewerOlder