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
RACSequence *views = [RACSequence concat:@[ | |
self.buttons.rac_sequence, | |
self.buttonLabels.rac_sequence, | |
self.informationLabels.rac_sequence | |
]]; | |
for (NSView *view in views) { | |
[view.layer rac_liftSelector:@selector(addAnimation:forKey:) withObjects:refreshingAnimation, @"opacity"]; | |
} |
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
- (id)initWithFrame:(CGRect)rect { | |
self = [super initWithFrame:rect]; | |
if (self == nil) return nil; | |
[self initializeComponent]; | |
RAC(self.title.text) = RACAble(self.viewModel.model.title); | |
RAC(self.userAndOrgTiles.itemSource) = RACAble(self.viewModel.userAndOrgTiles); | |
self.loginButton.rac_command = self.viewModel.showLoginCommand; |
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
- (RACSignal*)friendsId | |
{ | |
return [self enqueueWithCursor:-1]; | |
} | |
- (RACSignal*)enqueueWithCursor:(NSInteger)cursor | |
{ | |
@weakify(self); | |
return [[self idsAtCursor:cursor] | |
// Map each `next` (there should only be one) to a new signal. |
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 RACSocketReader : NSObject | |
// Sends a RACSignal whenever there's new data ready to be read. Each signal | |
// will send an NSData upon subscription. | |
// | |
// If you only want the NSData objects as fast as possible, simply -concat | |
// this signal to get a eager signal of NSData values. | |
@property (nonatomic, strong, readonly) RACSignal *signalOfDataSignals; | |
- (id)initWithSocketDescriptor:(int)fildes; |
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
// The weak pointer is read, and retained until the message send completes its synchronous work. | |
[weakValue doAThing]; |
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
// Check name validity | |
RACSignal *nameValid = [RACAbleWithStart(self.name) map:^(NSString *name) { | |
return @(name.length > 0); | |
}]; | |
RACSignal *nameValidationMessage = [nameValid map:^ id (NSNumber *valid) { | |
return valid.boolValue ? nil : @"Please enter a name that matches our bullshit rules"; | |
}]; | |
// Check email validity |
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 $(...) \ | |
({ \ | |
__weak __typeof__(self) weakSelf = self; \ | |
\ | |
^(__VA_ARGS__) { \ | |
__strong __typeof__(weakSelf) self = weakSelf; \ | |
$_body_ | |
#define $_body_(...) \ | |
__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
#define self \ | |
( \ | |
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wunused-value\"") self, \ | |
/* Depends on _cmd being a const copy, like other captured variables. */ \ | |
_Pragma("clang diagnostic pop") (*(_cmd = _cmd, &self)) \ | |
) | |
// Replace libextobjc's @weakify with one that's aware of the "self" macro. | |
#undef ext_weakify_ | |
#define ext_weakify_(INDEX, CONTEXT, VAR) \ |
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
Control/Monad/Trans/Resource.hs:613:24: | |
Could not deduce (m ~ IO) | |
from the context (MonadBaseControl IO m) | |
bound by the type signature for | |
resourceForkIO :: MonadBaseControl IO m => | |
ResourceT m () -> ResourceT m ThreadId | |
at Control/Monad/Trans/Resource.hs:601:19-81 | |
`m' is a rigid type variable bound by | |
the type signature for | |
resourceForkIO :: MonadBaseControl IO m => |
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
__block void (^myRecursiveBlock)(int); | |
id myBlock = ^(int x) { | |
if (x > 5) { | |
// Release the block from its own implicit retain cycle. | |
myRecursiveBlock = nil; | |
} else { | |
myRecursiveBlock(x + 1); | |
} | |
}; |