Using a real artsy example from today.
Creating a follow button on a view controller for different types of objects Artist, Profile, Gene
Needs: networking Needs: layout Needs: interface changes based on networking
command script import /opt/lldb-scripts/reveal.py | |
command alias interface_inspector p (BOOL)[[NSBundle bundleWithPath:@"/Applications/Interface Inspector.app/Contents/Resources/InterfaceInspectorRemote.framework"] load] | |
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2); | |
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2); | |
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil]; | |
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil]; |
@interface UIView (MPAdditions) | |
@end | |
@implementation UIView (MPAdditions) | |
- (id)debugQuickLookObject { | |
if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) { | |
return nil; | |
} | |
language: objective-c | |
before_install: gem install xcpretty -N | |
script: | |
- set -o pipefail | |
- make ci |
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
int i = 10; | |
while (i \ | |
\ | |
\ | |
\ | |
--> 0) { printf("%i\n", i); } | |
return EXIT_SUCCESS; |
Quick note: All that applies here is for the latest Java 7.x, which everybody is using anyways because rule number one among computer users nowadays is DONT INSTALL JAVA WHEN YOUR BROWSER ASKS YOU TO.
##Class Design
Lack of interfaces means reading the comments-strewn source for a class is tedious. JavaDoc tries its best.
Arrays of any kind declared public static final
are always mutable unless they are of length zero (at which point, you should be fired for declaring such an array).
Projects are rife with degenerate classes of the sort
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; | |
self.window.backgroundColor = [UIColor whiteColor]; | |
UIViewController *controller = [UIViewController new]; | |
controller.title = @"Testing..."; | |
self.rootViewController = [[UINavigationController alloc] initWithRootViewController:controller]; | |
self.window.rootViewController = self.rootViewController; | |
[self.window makeKeyAndVisible]; | |
// Use Aspects to hook into XCTestCase to get better feedback than just the log. |
BasedOnStyle: Chromium | |
AlignTrailingComments: true | |
BreakBeforeBraces: Allman | |
ColumnLimit: 0 | |
IndentWidth: 4 | |
KeepEmptyLinesAtTheStartOfBlocks: false | |
ObjCSpaceAfterProperty: true | |
ObjCSpaceBeforeProtocolList: true | |
PointerBindsToType: false | |
SpacesBeforeTrailingComments: 1 |
#!/bin/bash | |
PREVIOUS_HEAD=$1 | |
NEW_HEAD=$2 | |
BRANCH_SWITCH=$3 | |
if [[ $BRANCH_SWITCH == "1" && $PREVIOUS_HEAD != $NEW_HEAD ]]; then | |
# Kill the simulator. | |
SIM=`pgrep 'iPhone Simulator'` |
#import "XSmallTests.h" | |
xsm_given("an integer value") { | |
int v; | |
xsm_when("the value is 42") { | |
v = 42; | |
xsm_then("the value is the answer to the life, the universe, and everything") { | |
XCTAssertEqual(42, v); | |
} |