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' |
#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; |
// 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) |
// | |
// 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" |
Singleton.h | |
------------- | |
@protocol Singleton | |
@optional | |
+ (instancetype)sharedInstance; | |
@end |
enum Either<A, B> { | |
case Left(A) | |
case Right(B) | |
} | |
func isLeft<A,B>(it : Either<A,B>) -> Bool { | |
switch it { case .Left: return true; case .Right: return false } | |
} | |
func isRight<A,B>(it : Either<A,B>) -> Bool { |
/** | |
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. |