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
- (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 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 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 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 RSHasMarkdownLinks(NSString *x) | |
{ | |
NSString *searchText = x; | |
NSError *error = NULL; | |
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\[([^\\[]+)\\]\\(([^\\)]+)\\)" options:0 error:&error]; | |
NSUInteger numberOfMatches = [regex numberOfMatchesInString:searchText options:0 range:NSMakeRange(0, [searchText length])]; | |
return (numberOfMatches > 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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<system.webServer> | |
<modules runAllManagedModulesForAllRequests="false" /> | |
<httpErrors errorMode="Custom" existingResponse="Replace"> | |
<remove statusCode="404" /> | |
<error statusCode="404" responseMode="File" path="404.html" /> | |
</httpErrors> | |
<rewrite> | |
<rules> |
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 statusInfo = require('./StatusInfo'); | |
import commentInfo = require('./CommentInfo'); | |
var uuid = require('node-uuid'); | |
/** | |
Various types of user notifications that we can send. | |
The numeric values are sent to the client apps (Android, iOS, etc) so be careful changing them | |
*/ | |
enum NotificationType { |
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 <objc/objc-runtime.h> | |
#import "UIView+SGAutoLayoutExtensions.h" | |
@implementation UIView (SGAutoLayoutExtensions) | |
#ifdef DEBUG | |
- (NSString *)nsli_description | |
{ | |
return [self restorationIdentifier] ?: [NSString stringWithFormat:@"%@:%p", [self class], self]; |
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 async void RemoveDevices() | |
{ | |
CloudTableClient client = account.CreateCloudTableClient(); | |
CloudTable devicesTable = client.GetTableReference("PushNotificationDeviceTable"); | |
//// Good Form | |
await devicesTable.CreateIfNotExistsAsync(); | |
// Entity Resolver | |
EntityResolver<PushNotificationDevice> deviceResolver = (pk, rk, ts, props, etag) => |
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
UIDevice *device = [UIDevice currentDevice]; | |
UIDeviceOrientation currentOrientation = device.orientation; | |
BOOL isPhone = (device.userInterfaceIdiom == UIUserInterfaceIdiomPhone); | |
BOOL isTallPhone = ([[UIScreen mainScreen] bounds].size.height == 568.0); | |
if (UIDeviceOrientationIsPortrait(currentOrientation) == YES) | |
{ | |
// Do Portrait Things | |
if (isPhone == YES) | |
{ | |
// Do Portrait Phone Things |
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 KeychainAPI | |
let keychain: Keychain = Keychain(service: "com.secondgear.myapp", accessibility: Accessibility.WhenUnlocked) | |
let userAccount = Account(userName: "justinw@me.com", secret: "lovesecretsexgod") | |
keychain.add(userAccount) | |
let fetchedAccount:Account? = keychain.accountFor("justinw@me.com") | |
if (fetchedAccount != nil) | |
{ | |
fetchedAccount?.secret = "newpassword" |
OlderNewer