Skip to content

Instantly share code, notes, and snippets.

View designatednerd's full-sized avatar

Ellen Shapiro designatednerd

View GitHub Profile
/*
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"]
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;
@designatednerd
designatednerd / BadTest.m
Last active August 29, 2015 14:13
How Not To Write A Test
/*
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
@designatednerd
designatednerd / RangeDoesNotWorkThisWay
Last active August 29, 2015 14:09
Welp, I'm an idiot.
- (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;
}
@designatednerd
designatednerd / Constants.h
Last active August 29, 2015 14:06
Struct Constants Example
FOUNDATION_EXPORT const struct DNSUserDefaults {
__unsafe_unretained NSString *hasRunBefore;
__unsafe_unretained NSString *hasMadeInAppPurchase;
} DNSUserDefaults;

Keybase proof

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: