layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories:
- Testing
- iOS
- Patterns
- Xcode
NSData *bom = nil; | |
NSStringEncoding encoding = ...; | |
NSData *a = [@"a" dataUsingEncoding:encoding]; | |
NSData *aa = [@"aa" dataUsingEncoding:encoding]; | |
if ([a length] * 2 != [aa length]) { | |
NSUInteger characterLength = [aa length] - [a length]; | |
bom = [a subdataWithRange:NSMakeRange(0, [a length]-characterLength)]; | |
} |
- (void)loadDefaultSettings | |
{ | |
NSMutableDictionary *defaults = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default-Settings" ofType:@"plist"]]; | |
// other setup... | |
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithDictionary:defaults]]; | |
} | |
- (void)resetDefaultSettings |
#import <dlfcn.h> | |
#import <Foundation/Foundation.h> | |
struct BlockDescriptor | |
{ | |
unsigned long reserved; | |
unsigned long size; | |
void *rest[1]; |
Dear soon-to-be-former user, | |
We've got some fantastic news! Well, it's great news for us anyway. You, on | |
the other hand, are fucked. | |
We've just been acquired by: | |
-(void)addContact{ | |
ABRecordRef person; | |
ABMultiValueRef social = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType); | |
ABMultiValueAddValueAndLabel(social, [NSDictionary dictionaryWithObjectsAndKeys: | |
(NSString *)kABPersonSocialProfileServiceTwitter, kABPersonSocialProfileServiceKey, | |
@"justinbieber", kABPersonSocialProfileUsernameKey, | |
nil], kABPersonSocialProfileServiceTwitter, NULL); | |
ABRecordSetValue(person, kABPersonSocialProfileProperty, social, NULL); | |
CFRelease(social); |
From c5a7d1115318bd02145a4b41109464d564b37af9 Mon Sep 17 00:00:00 2001 | |
From: David Weinstein <dweinst@insitusec.com> | |
Date: Mon, 14 Jan 2013 12:21:37 -0500 | |
Subject: [PATCH] add HID support to android gadget. | |
--- | |
drivers/usb/gadget/android.c | 189 ++++++++++++++++++++++++++++++++++++++++++ | |
drivers/usb/gadget/f_hid.c | 8 +- | |
2 files changed, 194 insertions(+), 3 deletions(-) |
#!/usr/bin/env ruby | |
# | |
# This script can be used to check the in-store availability of the iPhone 5S. | |
# By default, it searches for all AT&T models. You can change this by editing | |
# the MY_DEVICES array below. While the Apple API supports searching for | |
# multiple devices at once, there is a limit. | |
# | |
# Once you have properly configured the MY_DEVICES array, you can run this script | |
# from the terminal. It takes a single parameter, which should be the zip code you | |
# wish to use for your search. |
// = Requirements: freetype 2.5, libpng, libicu, libz, libzip2 | |
// = How to compile: | |
// % export CXXFLAGS=`pkg-config --cflags freetype2 libpng` | |
// % export LDFLAGS=`pkg-config --libs freetype2 libpng` | |
// % clang++ -o clfontpng -static $(CXXFLAGS) clfontpng.cc $(LDFLAGS) \ | |
// -licuuc -lz -lbz2 | |
#include <cassert> | |
#include <cctype> | |
#include <iostream> | |
#include <memory> |
/** | |
Provides the ability to verify key paths at compile time. | |
If "keyPath" does not exist, a compile-time error will be generated. | |
Example: | |
// Verifies "isFinished" exists on "operation". | |
NSString *key = SQKeyPath(operation, isFinished); | |
// Verifies "isFinished" exists on self. |
layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories: