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
| // From zoul - http://stackoverflow.com/questions/7853915/how-do-i-avoid-capturing-self-in-blocks-when-implementing-an-api | |
| #pragma clang diagnostic push | |
| #pragma clang diagnostic ignored "-Warc-retain-cycles" | |
| self.progressBlock = ^(CGFloat percentComplete) { | |
| [self.delegate processingWithProgress:percentComplete]; | |
| } | |
| #pragma clang diagnostic pop |
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
| - (void)viewWillAppear:(BOOL)animated | |
| { | |
| [super viewWillAppear:animated]; | |
| // Adjust the table view's content inset when the keyboard appears/disappears | |
| _keyboardWillShowNotification = [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification | |
| object:nil | |
| queue:nil | |
| usingBlock:^(NSNotification *note) | |
| { |
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 <Foundation/Foundation.h> | |
| int main (int argc, const char * argv[]) | |
| { | |
| @autoreleasepool { | |
| NSString *dateString = @"8:56pm 29 Feb"; | |
| NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; | |
| [formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]]; | |
| [formatter setDateFormat:@"h:mma d MMM"]; |
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
| - (void)showTweetSheet | |
| { | |
| TWTweetComposeViewController *composeVC = [[TWTweetComposeViewController alloc] init]; | |
| NSString *tweet = @"Hello, this is a message that is 117 characters long. Let's add a bunch more characters to see how long we can make i"; | |
| //!!! BUG: If you switch the order of these two calls, the URL will not get added. | |
| BOOL urlAdded = [composeVC addURL:[NSURL URLWithString:@"http://developer.apple.com/library/ios"]]; | |
| BOOL textAdded = [composeVC setInitialText:tweet]; | |
| #pragma unused(urlAdded) |
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 NSCachedURLResponse(HackityHack) | |
| - (id)initWithCoder:(NSCoder *)aDecoder | |
| { | |
| return [self initWithResponse:[aDecoder decodeObjectForKey:@"response"] | |
| data:[aDecoder decodeObjectForKey:@"data"] | |
| userInfo:[aDecoder decodeObjectForKey:@"userInfo"] | |
| storagePolicy:(NSURLCacheStoragePolicy)[aDecoder decodeIntForKey:@"storagePolicy"]]; | |
| } |
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
| # From: http://snippets.dzone.com/posts/show/3029 | |
| # .generate creates an object containing both keys | |
| new_key = OpenSSL::PKey::RSA.generate( 1024 ) | |
| puts "Does the generated key object have the public key? #{new_key.public?}\n" | |
| puts "Does the generated key object have the private key? #{new_key.private?}\n\n" | |
| # write the new keys as PEM's | |
| new_public = new_key.public_key | |
| puts "New public key pem:\n#{new_public}\n" | |
| puts "The new public key in human readable form:\n" |
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
| 41c41 | |
| < | |
| --- | |
| > | |
| 655,668d654 | |
| < def test_should_set_an_error_into_the_parent_on_before_destroy | |
| < @child_1.class.before_destroy do |object| | |
| < object.errors.add(:name, :undeletable) | |
| < false | |
| < 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
| From 3b8aa2b5cbfd5c72f2143f12236e6fad734b61e5 Mon Sep 17 00:00:00 2001 | |
| From: Jason Garber <jg@jasongarber.com> | |
| Date: Wed, 27 Apr 2011 15:06:19 -0600 | |
| Subject: [PATCH] Allow a label with the value option to have value-specific translations. | |
| --- | |
| actionpack/lib/action_view/helpers/form_helper.rb | 3 ++- | |
| actionpack/test/template/form_helper_test.rb | 12 +++++++++++- | |
| 2 files changed, 13 insertions(+), 2 deletions(-) |
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
| From 630a55c8ece0fe1616e7785539e97f1a6da0816c Mon Sep 17 00:00:00 2001 | |
| From: Frederick Cheung <frederick.cheung@gmail.com> | |
| Date: Tue, 26 Apr 2011 10:12:07 +0100 | |
| Subject: [PATCH 1/2] Calculate time spent in AR even if a redirect occurs or if it is after the render | |
| --- | |
| .../test/activerecord/controller_runtime_test.rb | 29 +++++++++++++++++++- | |
| .../active_record/railties/controller_runtime.rb | 14 +++++---- | |
| 2 files changed, 36 insertions(+), 7 deletions(-) |
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
| From 61eae0f2b1bfcb54f0355b710808bdcd5fe64b84 Mon Sep 17 00:00:00 2001 | |
| From: Chad Krsek <chad.krsek@gmail.com> | |
| Date: Mon, 25 Apr 2011 21:57:28 -0700 | |
| Subject: [PATCH] asset helpers should understand scheme-relative URLs | |
| --- | |
| actionpack/lib/action_view/helpers/asset_paths.rb | 11 +++++++++-- | |
| actionpack/test/template/asset_tag_helper_test.rb | 15 +++++++++++++++ | |
| 2 files changed, 24 insertions(+), 2 deletions(-) |