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 Foundation | |
enum Cheese : String { | |
case Mozzarella = "Mozzarella" | |
case Provolone = "Provolone" | |
case Pecorino = "Pecorino" | |
} | |
class PizzaBuilder { | |
var size: Int = 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
class MockURLSession : NSURLSession { | |
var request: NSURLRequest? | |
override func dataTaskWithRequest(request: NSURLRequest, completionHandler: ((NSData!, NSURLResponse!, NSError!) -> Void)?) -> NSURLSessionDataTask { | |
self.request = request | |
return super.dataTaskWithRequest(request, completionHandler: completionHandler) | |
} | |
} |
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
[RKRequestDescriptor requestDescriptorWithMapping:[mappingProvider.orderConfirmationMapping inverseMapping] | |
objectClass:[WTNOrderConfirmation class] | |
rootKeyPath:@"confirmation" | |
method:RKRequestMethodPOST]; | |
// In the mapping provider | |
- (RKObjectMapping *)orderConfirmationMapping; | |
{ | |
if (!_orderConfirmationMapping) { | |
_orderConfirmationMapping = [RKObjectMapping mappingForClass:[WTNOrderConfirmationResponse class]]; |
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
if ! git diff-index --cached --name-only --exit-code -G "fdescribe" $against | |
then | |
echo "\nRemove occurences of fdescribe from listed files." | |
exit 1 | |
fi |
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
let json = [{ | |
name: "Klaas Pieter Annema", | |
age: 28 | |
}, // Compiler infers Integer type for age | |
{ | |
name: "Chris Eidhof", | |
age: "Unknown" | |
} // Compiler infers String type for age | |
]; |
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
package com.yourkarma.android.ui.components; | |
import android.content.Context; | |
import android.graphics.Color; | |
import android.graphics.PorterDuff; | |
import android.graphics.drawable.Drawable; | |
import android.util.AttributeSet; | |
public class ProgressBar extends android.widget.ProgressBar { |
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
[[NSDateFormatter dateFormatFromTemplate:@"HHa" options:0 locale:[NSLocale currentLocale]] stringByReplacingOccurrencesOfString:@" " withString:@""]; |
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
describe(@"when the retry button is tapped", ^{ | |
before(^{ | |
_fetcher = mock([ProductFetcher class]); | |
_viewController.productFetcher = _fetcher; | |
[_viewController.errorView.button sendActionsForControlEvents:UIControlEventTouchUpInside]; | |
}); | |
it(@"retries fetching the products", ^{ | |
[verify(_fetcher) fetch]; | |
}); |
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
CGRect rect = {{.x = 0.0, .y = 0.0}, {.width = 0.0, .height = 0.0}}; | |
CGRect rect = {0.0, 0.0, 0.0, 0.0} |