This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UIImageView (CMAsyncExtension) | |
- (void)asyncLoadImageFromURL:(NSURL *)imageURL; | |
@end | |
@implementation UIImageView (CMAsyncExtension) | |
- (void)asyncLoadImageFromURL:(NSURL *)imageURL | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Bash 4 using homebrew | |
brew install bash | |
# Or build it from source... | |
curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz | |
tar xzf bash-4.2.tar.gz | |
cd bash-4.2 | |
./configure --prefix=/usr/local/bin && make && sudo make install | |
# Add the new shell to the list of legit shells |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- IMPORTANT: Using this will kill your undo history | |
Steps: | |
- In Xcode > Select your project > "Build Phases" > "Add Build Phase" > "Add Run Script" | |
- Paste this script: | |
sed -i '' 's/[[:space:]]*$//' `find . -name *.h -o -name *.m -not \( -name .svn -prune -o -name .git -prune \) -type f` | |
- Now whitespace will be removed from .h and .m files on build | |
- Only problem, doesn't work if path contains a space.... any ideas? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[schwa@ungoliant] ~$ export OBJC_HELP=1 | |
[schwa@ungoliant] ~$ /Applications/Safari.app/Contents/MacOS/Safari | |
objc[10559]: Objective-C runtime debugging. Set variable=YES to enable. | |
objc[10559]: OBJC_HELP: describe available environment variables | |
objc[10559]: OBJC_PRINT_OPTIONS: list which options are set | |
objc[10559]: OBJC_PRINT_IMAGES: log image and library names as they are loaded | |
objc[10559]: OBJC_PRINT_LOAD_METHODS: log calls to class and category +load methods | |
objc[10559]: OBJC_PRINT_INITIALIZE_METHODS: log calls to class +initialize methods | |
objc[10559]: OBJC_PRINT_RESOLVED_METHODS: log methods created by +resolveClassMethod: and +resolveInstanceMethod: | |
objc[10559]: OBJC_PRINT_CLASS_SETUP: log progress of class and category setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# updates your info.plist with the current git tag as version and commit number | |
# in that tag as build numer, then ammends the changed file to git | |
# run this after your normal commit but before you push | |
# | |
# this to be placed in the same directory as the xcode project file | |
# info.plist to be in the path [folder with projectfile]/[project name]/[project name]-Info.plist | |
# git tags to be in the form of v[number] | |
# | |
# Don't forget to do chmod +x ~/whatever/vTag.sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Prevent Xcode 4.1 from using 100% CPU due to a bug while attempting to | |
connect to a remote iOS device. | |
# 1. Compile the patch | |
$ gcc -lobjc -fobjc-gc -framework Foundation -bundle -o _patch NDVXcodeRemoteDevicePatch.m | |
# 2. Find the PID of Xcode | |
$ XcodePID=`pidof Xcode` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git submodule foreach "git add ." | |
git submodule foreach "git commit -m \"$1\"" | |
git add . | |
git commit -m "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define CAT(a, b) _PRIMITIVE_CAT(a, b) | |
#define _PRIMITIVE_CAT(a, b) a##b | |
#define N_ARGS(...) N_ARGS_1(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) | |
#define N_ARGS_1(...) N_ARGS_2(__VA_ARGS__) | |
#define N_ARGS_2(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, n, ...) n | |
#define PROPERTY(policy, ...) CAT(_PROPERTY_, N_ARGS(__VA_ARGS__))(policy, __VA_ARGS__) | |
#define PROPERTY_STRONG(...) PROPERTY(retain, __VA_ARGS__) | |
#define PROPERTY_WEAK(...) PROPERTY(assign, __VA_ARGS__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ModelUtil.h | |
// | |
// Copyright 2011 Chris Miles. All rights reserved. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "SenTestCase+MethodSwizzling.m" | |
@interface ExampleTest : SenTestCase {} | |
+ (BOOL)trueMethod; | |
+ (BOOL)falseMethod; | |
@end | |
@implementation ExampleTest | |
+ (BOOL)trueMethod { return YES; } |