Convert Ruby 1.8 to 1.9 hash syntax
nnoremap <Leader>: :%s/:\([^ ]*\)\(\s*\)=>/\1:/gc<CR>
static id _commonInit(MyView *self) | |
{ | |
// common init stuff like so... | |
self.opaque = YES; | |
self->_scale = 1.0; | |
return self; | |
} | |
- initWithFrame:(CGRect)frame; |
# based on https://gist.github.com/3349345 | |
# Thanks, @alloy! | |
# | |
# To get your project ready for this, you'll have to create a scheme for your unit test project, make sure run is checked in | |
# the build step, and then delete the Test Host setting. | |
# Also, make sure you have the colored and open4 gems installed. | |
require 'rubygems' | |
require 'colored' | |
require 'pathname' |
Generate the list yourself:
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./* | \
sed 's/NS_AVAILABLE_IOS(.*)//g' | \
sed 's/NS_DEPRECATED_IOS(.*)//g' | \
sed 's/API_AVAILABLE(.*)//g' | \
sed 's/API_UNAVAILABLE(.*)//g' | \
sed 's/UI_APPEARANCE_SELECTOR//g' | \
function fixXcode | |
{ | |
pushd > /dev/null | |
cd | |
xcodepath=`xcode-select --print-path`/.. | |
destination=$xcodepath/Frameworks/IDEKit.framework/Versions/A/Resources/SystemCodeSnippets.codesnippets | |
shouldRelaunchXcode=false | |
if [[ `osascript -e 'tell app "System Events" to count processes whose name is "Xcode"'` == 1 ]]; then |
#import "KWMatcher.h" | |
typedef BOOL (^FTKiwiCustomMatcherBlock)(id subject); | |
@interface FTKiwiCustomBlockMatcher : KWMatcher | |
// Your custom matcher block will receive the expectation ‘subject’ and must | |
// return `YES` if the expaction passes or `NO` if it fails. | |
- (void)be:(FTKiwiCustomMatcherBlock)block; |
// | |
// YMKeyboardLayoutHelperView.m | |
// ios-chat | |
// | |
// Created by Steven Hepting on 7/17/13. | |
// Copyright (c) 2013 Yammer. All rights reserved. | |
// | |
#import "YMKeyboardLayoutHelperView.h" | |
#import "UIView+LayoutAdditions.h" |
/** | |
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. |
// http://stackoverflow.com/a/19277383 | |
// | |
- (void)textViewDidChange:(UITextView *)textView | |
{ | |
CGRect line = [textView caretRectForPosition:textView.selectedTextRange.start]; | |
CGFloat overflow = line.origin.y + line.size.height | |
- ( textView.contentOffset.y + textView.bounds.size.height | |
- textView.contentInset.bottom - textView.contentInset.top ); | |
if (overflow > 0) { | |
// We are at the bottom of the visible text and introduced a line feed, scroll down (iOS 7 does not do it) |
Singleton.h | |
------------- | |
@protocol Singleton | |
@optional | |
+ (instancetype)sharedInstance; | |
@end |