I hereby claim:
- I am jmnavarro on github.
- I am jmnavarro (https://keybase.io/jmnavarro) on keybase.
- I have a public key whose fingerprint is 72FB 7F2A 24BD EEC9 0BCD 5C6A 3399 DBAA D1E2 E912
To claim this, I am signing this object:
| // | |
| // NSProcessInfo+DetectTestEnvironment.h | |
| // Memoir | |
| // | |
| // Created by JM - http://jmnavarro.github.com | |
| // | |
| #import <Foundation/Foundation.h> | |
| @interface NSProcessInfo (DetectTestEnvironment) |
| cd ./Images | |
| for f in *.png; do | |
| fn=`echo "$f" | cut -d'.' -f1` | |
| if ! grep -q @2x <<< $fn; then | |
| if ! $(grep -i -r --include=*.m --include=*.xib "`echo "$f" | cut -d'.' -f1`" ../Classes/ > /dev/null); then | |
| echo $f | |
| fi | |
| fi | |
| done |
| func XCTAssertOptional(expression: @autoclosure () -> AnyObject?, _ message: String? = nil) { | |
| let evaluatedExpression:AnyObject? = expression() | |
| if evaluatedExpression == nil { | |
| if let messageValue = message { | |
| XCTFail(messageValue) | |
| } | |
| else { | |
| XCTFail("Optional asertion failed: \(evaluatedExpression)") | |
| } |
| extension Bool : StringLiteralConvertible { | |
| static public func convertFromStringLiteral(value: StringLiteralType) -> Bool { | |
| return (value.lowercaseString == "false") ? false : true | |
| } | |
| static public func convertFromExtendedGraphemeClusterLiteral(value: StringLiteralType) -> Bool { | |
| return convertFromStringLiteral(value) | |
| } |
| // | |
| // returns the list of different extensions from a bunch of files | |
| // | |
| func differentExtensions(fileNames: [String]) { | |
| // Step 1. Map: process file names list to convert to extensions list | |
| let allExtensions = fileNames.map { $0.pathExtension.lowercaseString } | |
| // Step 2. Reduce: iterate removing duplicates | |
| return allExtensions.reduce([String]()) { (acum, value) -> [String] in |
I hereby claim:
To claim this, I am signing this object:
| func given(givenText: String, givenCode: ()->(), | |
| when whenText: String, whenCode: ()->(), | |
| then thenText: String, thenCode: ()->()) { | |
| println("\n\n=> SCENARIO\n\tGiven '\(givenText)'\n\tWhen '\(whenText)'\n\tThen '\(thenText)'") | |
| givenCode() | |
| whenCode() | |
| thenCode() | |
| } |
| /* | |
| * Handles the scenario when you have concurrent operations using | |
| * the same activity indicator. Without care, this leads to stop the | |
| * indicator when the first operation ends: | |
| * Start A | |
| * Start B | |
| * Start C | |
| * Finish B -> without this extensions, the indicator will be stopped here | |
| * Finish C | |
| * Finish A -> with this extensions, the indicator will be stopped here |
| // This is the link between the model and the view | |
| // Mascot <-> MascotTableViewCell | |
| extension CollectionType where Generator.Element == Employee { | |
| func elementByPosition(position: Int) -> Self.Generator.Element? { | |
| // dirty hack. It's already implemented in Array subscript with O(1) instead of O(n) | |
| var i = 0 | |
| for e in self { | |
| if i++ == position { | |
| return e |
| var number: Int? | |
| number.flatMap { | |
| // this is never executed | |
| print($0) | |
| } | |
| number = 1 | |
| number.flatMap { |