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
def get_panelist_array(div) | |
# Regex to get rid of bracketed stuff | |
r = /\[.*\]/ | |
panelists = div.gsub(r,"") | |
panelists = panelists.gsub("<i>Panelists include: ","") | |
panelists = panelists.gsub("</i>","") | |
panelists = panelists.split(", ") | |
xml = "\t\t<array>\n" |
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
@implementation Contacts | |
+ (UIImage *)imageForContactWithName:(NSString *)name { | |
// Create a CF string reference from the NSString pointer | |
CFStringRef cfName = objc_unretainedPointer(name); | |
UIImage *personImage = nil; | |
// Create a reference to the address book | |
ABAddressBookRef addressBook = ABAddressBookCreate(); |
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
require 'openssl' | |
require 'socket' | |
require 'rubygems' | |
require 'json' | |
# Takes json as an input and sends data to APNS over SSL | |
APNS_HOST = 'gateway.sandbox.push.apple.com' | |
APNS_PORT = 2195 | |
APNS_CERT_FILE_PATH = 'MyCert.pem' |
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
@interface ProxyCache : NSURLCache | |
@end | |
@implementation ProxyCache | |
- (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request { | |
if ([request.URL.absoluteString hasPrefix:@"https://www.amazon.com/ap/uedata?"]) { | |
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL | |
MIMEType:@"text/plain" | |
expectedContentLength: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
#import "AWSHTTPRequest.h" | |
#import "AWSVersion4RequestSigner.h" | |
- (void)exampleRequest { | |
NSString *service = @"glacier"; | |
NSString *region = @"us-west-2"; | |
NSString *host = [NSString stringWithFormat:@"%@.%@.amazonaws.com", service, region]; | |
AWSVersion4RequestSigner *v4Signer = [[AWSVersion4RequestSigner alloc] initWithAccessKey:@"YOURKEY" secretKey:@"YOURSECRETKEY"]; | |
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
require 'jcs3' | |
def content_type_for_extension(extension) | |
return "text/html" if %w[html htm].include?(extension) | |
return "text/css" if %w[css].include?(extension) | |
return "application/javascript" if %w[js].include?(extension) | |
return "image/gif" if %w[gif].include?(extension) | |
return "image/jpeg" if %w[jpeg jpg].include?(extension) | |
return "image/png" if %w[png].include?(extension) | |
return "image/tiff" if %w[tiff tf].include?(extension) |
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)observeKeyboardNotifications | |
{ | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; | |
} | |
- (void)stopObservingKeyboardNotifications | |
{ | |
[[NSNotificationCenter defaultCenter] removeObserver: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
{ | |
"currentLeader":{ | |
"role":{ | |
"name":"Loyal Servant of Arthur", | |
"type":2 | |
}, | |
"playerId":"RND 6" | |
}, | |
"voteNumber":1, | |
"passedQuestCount":3, |