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
#import <XCTest/XCTest.h> | |
#import "RSFoundationExtras.h" | |
@interface RSFoundationExtrasTests : XCTestCase | |
@end | |
@implementation RSFoundationExtrasTests | |
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
#import <XCTest/XCTest.h> | |
#import "RSFoundationExtras.h" | |
@interface RSFoundationExtrasTests : XCTestCase | |
@end | |
@implementation RSFoundationExtrasTests | |
- (void)testExtractingLinksFromAPost |
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
- (NSArray *)rs_links { | |
if (RSStringIsEmpty(self)) | |
return nil; | |
NSString *searchText = self; | |
NSMutableArray *links = [NSMutableArray array]; | |
/*The regex pattern is from Daring Fireball: <http://daringfireball.net/2010/07/improved_regex_for_matching_urls> |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI)) | |
#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI) | |
#define ARC4RANDOM_MAX 0x100000000 | |
double startingLatitude = DEGREES_TO_RADIANS(39.753638); | |
double startingLongitude = DEGREES_TO_RADIANS(-105.007375); | |
double earthRadius = 3960.056052; | |
double maxdist = 50.0f; |
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
- (UIImage *)ciThumbnailImage:(UIImage *)image | |
{ | |
CIImage *ciImage = [[CIImage alloc] initWithCGImage:image.CGImage options:nil]; | |
CGFloat originalHeight = [ciImage extent].size.height; | |
CGFloat originalWidth = [ciImage extent].size.width; | |
CGFloat desiredHeight = 128.0f; | |
CGFloat desiredWidth = 128.0f; | |
CIFilter *scaleFilter = [CIFilter filterWithName:@"CILanczosScaleTransform"]; |
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
{ | |
"formatVersion" : 1, | |
"filterIdentifier" : "filter.com.secondgear.Noir", | |
"filterName" : "Noir", | |
"filterDescription" : "FILTER_DESCRIPTION", | |
"requirements" : [ | |
"iOS > 6.0" | |
], | |
"organizationName" : "Justin Williams", | |
"organizationURL" : "http://carpeaqua.com", |
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
#import <UIKit/UIKit.h> | |
@interface UIImageView (SGExtensions) | |
- (CGRect)sg_imageFrame; | |
@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
// | |
// SGDeviceIdentifier.h | |
// Elements | |
// | |
// Created by Justin Williams on 9/28/12. | |
// Copyright (c) 2012 Second Gear. All rights reserved. | |
// | |
#import <Foundation/Foundation.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
// | |
// OLD AND BUSTED | |
// | |
if ([self.zoomingDelegate respondsToSelector:@selector(zoomingWindow:didZoomOutViewController:)] == YES) | |
{ | |
// Do something important. | |
} | |
// |