Skip to content

Instantly share code, notes, and snippets.

View rodericj's full-sized avatar
🐔
chicken

Roderic Campbell rodericj

🐔
chicken
View GitHub Profile
mainTextVerticalConstraint
{
"meta": {
"code": 200
},
"notifications": [
{
"type": "notificationTray",
"item": {
"unreadCount": 0
}
[[RACSignal combineLatest:@[[device.batteryLife deliverOn:[RACScheduler mainThreadScheduler]], [device.onlineState deliverOn:[RACScheduler mainThreadScheduler]]] reduce:^(NSNumber *level, NSNumber *stateEnum)
{
MorseDeviceConnectedState state = (MorseDeviceConnectedState) [stateEnum integerValue];
switch (state)
{
case MorseDeviceConnectedStateConnected:
{
NSString *string;
if ([level floatValue] > 0)
string = [NSString stringWithFormat:@"%0.f%%", [level floatValue] * 100];
[[RACSignal combineLatest:@[device.batteryLife, device.onlineState] reduce:^(NSNumber *level, NSNumber *stateEnum)
{
MorseDeviceConnectedState state = (MorseDeviceConnectedState) [stateEnum integerValue];
NSMutableDictionary *ret = [[NSMutableDictionary alloc] initWithCapacity:2];
switch (state)
{
case MorseDeviceConnectedStateConnected:
{
if ([level floatValue] > 0)
ret[@"string"] = [NSString stringWithFormat:@"%0.f%%", [level floatValue] * 100];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
UIBezierPath *path = [UIBezierPath bezierPathWithRect:topMaskRect];
[path appendPath:[UIBezierPath bezierPathWithRect:bottomMaskRect]];
maskLayer.path = path.CGPath;
// Create a mask layer and the frame to determine what will be visible in the view.
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
CGRect topMaskRect = CGRectMake(0, 0, 100, 10);
CGRect bottomMaskRect = CGRectMake(0, 33, 100, 10);
// Create a path with the top rect in it.
CGMutablePathRef path = CGPathCreateMutableCopy(CGPathCreateWithRect(topMaskRect, NULL));
// now add the bottom rect to path
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
CGRect maskRect = self.coneImageView.frame;
NSLog(@"Mask rect is %@", NSStringFromCGRect(maskRect));
// Create a path with the rectangle in it.
CGPathRef path = CGPathCreateWithRect(maskRect, NULL);
// Set the path to the mask layer.
maskLayer.path = path;
// Release the path since it's not covered by ARC.
self.connectorLineHeightConstraint.constant = 44;
[UIView animateWithDuration:3 animations:^{
[self layoutIfNeeded];
}];
RACSignal *emailTextFieldHoldsEmail = [self.textField.rac_textSignal map:^id(id value) {
return @([value isEmail]);
}];
RAC(self.sendButton, enabled) = emailTextFieldHoldsEmail;
RAC(self.sendButton, alpha) = [emailTextFieldHoldsEmail map:^id(id value) {
return [value boolValue] ? @1 : @.5;
}];
2014-10-23 13:36:20.584 Aether Cone[7927:1211130] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSSetM addObject:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x05e87946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x05b10a97 objc_exception_throw + 44
2 CoreFoundation 0x05d9e18b -[__NSSetM addObject:] + 699
3 Aether Cone 0x0037224e -[MRSECommManager initWithResourceId:andName:andCredential:andCapabilities:] + 2734
4 Aether Cone 0x00268de0 -[CommController setupCommWithResourceId:andName:andCredential:andCapabilities:] + 368
5 Aether Cone 0x001b6ac5 -[ProvisioningController morseProvisioningSuccessfullyCreatedUserAccount:] + 6677
6 Foundation 0x02716c49 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 40