I hereby claim:
- I am designatednerd on github.
- I am designatednerd (https://keybase.io/designatednerd) on keybase.
- I have a public key whose fingerprint is 636E F994 2D18 33BB 86A3 97C4 F94C 162F 31C3 B0E1
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
FOUNDATION_EXPORT const struct DNSUserDefaults { | |
__unsafe_unretained NSString *hasRunBefore; | |
__unsafe_unretained NSString *hasMadeInAppPurchase; | |
} DNSUserDefaults; |
- (BOOL)doesStringContainSpecificString:(NSString *)passedInString | |
{ | |
NSRange rangeOfString = [passedInString rangeOfString:@"a string"]; | |
if (rangeOfString.location != NSNotFound) { | |
//String was found, do stuff | |
return YES; | |
} //else string was not found, don't bother | |
return NO; | |
} |
/* | |
The most horrendous test case I've ever found in client code, and a great example | |
of why "Your code must have X% test coverage" is a dangerous way to evaluate | |
whether something is properly tested. | |
Class prefixes have been changed to CLT (for Client) to protect the guilty. All | |
else is from the original. | |
*/ | |
- (void)testShouldLogResponseOnSuccess |
package com.[my package].rule; | |
import org.junit.Assume; | |
import org.junit.rules.TestRule; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; | |
import timber.log.Timber; | |
import java.lang.annotation.*; | |
import java.lang.reflect.Modifier; |
/* | |
Some playing around with a playground in Swift to try and figure out how to make Funcitonal | |
stuff more readable. Initial example from: | |
http://www.raywenderlich.com/82599/swift-functional-programming-tutorial | |
*/ | |
import Foundation | |
let words = [ "Cat", "Chicken", "fish", "Dog", "Mouse", "Guinea Pig", "monkey"] |
/* | |
Fun with NSNumber to integer and unsigned integer conversions! This | |
bit someone trying to use key-value coding to get the average of a | |
given number out of an array of items with an NSUInteger property. | |
The NSNumber which came out of the @avg.value KVC method was of value | |
588.33333333333333333333333333333333333. The person then tried to access | |
this value by calling both average.integerValue and | |
average.unsignedIntegerValue. |
/** | |
How to get a method which takes any string enumeration in Swift 2.1. | |
Actually figured out by Carl Hill-Popper, documented by me. | |
*/ | |
import UIKit | |
// 1) Make you some string enums. |
//Counts the number of commits on the HEAD of the repo. | |
def headCommitCount() { | |
def cmd = "git rev-list HEAD --count" | |
return cmd.execute().text.toInteger() | |
} | |
android { | |
defaultConfig { | |
versionCode headCommitCount() //Auto-increment the version based on how many commits have occurred. | |
versionName "x.x.x (" + versionCode + ")" |
import Foundation | |
/** | |
A swift protocol to make any Int enum able to count its cases. | |
Super-useful for making enums to help you deal with sections in tableviews without having to maintain a case for the count of the enum. | |
Originally developed by Logan Wright for Swift 2.0 here: | |
https://gist.github.com/LoganWright/c8a26b1faf538e40f747 | |