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
// Use the __block storage modifier to allow changes to 'price' | |
__block float price = 1.99; | |
float (^finalPrice)(int) = ^(int quantity) | |
{ | |
return quantity * price; | |
}; | |
int orderQuantity = 10; | |
price = .99; |
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
[UIView beginAnimations:@"ToggleSiblings"context:nil]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; | |
[UIViewsetAnimationDuration:1.0]; | |
// Make your changes | |
[UIView commitAnimations]; |
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
[UIView animateWithDuration:5.0animations:^{ | |
view.opacity = 0.5; | |
}]; |
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
unary_operation_t square; | |
square = ^(double operand) { | |
return operand * operand; | |
} |
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
[NSLayoutConstraint constraintWithItem:button | |
attribute:NSLayoutAttributeBottom | |
relatedBy:NSLayoutRelationEqual | |
toItem:superview | |
attribute:NSLayoutAttributeBottom | |
multiplier:1.0 | |
constant:-padding] |
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
[NSLayoutConstraint constraintsWithVisualFormat:@"[cancelButton]-[acceptButton]" | |
options:0 | |
metrics:nil | |
views:viewsDictionary]; |
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
UIButton *cancelButton = ... | |
UIButton *acceptButton = ... | |
viewsDictionary = NSDictionaryOfVariableBindings(cancelButton,acceptButton); |
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
[UIView animateWithDuration:0.5 animations:^{ | |
[view layoutIfNeeded]; | |
}]; |
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
my $array = decode_json($json_out); |
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
get { | |
var freeObject = (from item in objectList | |
where item.active == false | |
select item).FirstOrDefault(); | |
if (freeObject == null) { | |
freeObject = Object.Instantiate(objectToRecycle); | |
objectList.Add(freeObject); | |
} | |
return freeObject; | |
} |