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
console.log('abc'); |
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
- (void)bounceAnimation:(void (^)())completion | |
{ | |
CGRect rect = self.frame; | |
CGRect insetRect = CGRectInset(rect, 10, 10); | |
self.frame = insetRect; | |
[UIView animateWithDuration:1 delay:0 usingSpringWithDamping:0.4 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ | |
self.frame = rect; | |
} completion:^(BOOL finished) { |
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
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{ | |
[super setHighlighted:highlighted]; | |
[self setNeedsDisplay]; | |
if (animated) { | |
[UIView transitionWithView:self duration:0.1 | |
options:UIViewAnimationOptionTransitionCrossDissolve | |
animations:^{ | |
[self.layer displayIfNeeded]; | |
} completion:nil]; | |
} |
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
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.window.screen.scale); | |
[self.imageView drawViewHierarchyInRect:self.frame afterScreenUpdates:YES]; | |
UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); |
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.5f delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ | |
//animation | |
} completion:^(BOOL finished) { | |
//completion | |
}]; |
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
CATransition *animation = [CATransition animation]; | |
[animation setType:kCATransitionPush]; | |
[animation setSubtype:kCATransitionFade]; | |
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; | |
[animation setFillMode:kCAFillModeBoth]; | |
[animation setDuration:.05]; | |
[collectionView.layer addAnimation:animation forKey:kCATransition]; |
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
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller | |
{ | |
self.shouldReloadCollectionView = NO; | |
self.blockOperation = [[NSBlockOperation alloc] init]; | |
} | |
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type | |
{ | |
__block UICollectionView *collectionView = self.collectionView; | |
switch (type) { | |
case NSFetchedResultsChangeInsert: { |
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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
def findAllFiles(path): | |
for root, dirs, files in os.walk(os.path.expanduser(path)): | |
yield root | |
for file in files: | |
yield os.path.join(root, file) | |
for file in findAllFiles(''): | |
print (file) |
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
+ (CGFloat)heightOfCellWithTableView:(UITableView *)tableView obj:(id)obj | |
{ | |
static MMCell *sizingCell = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sizingCell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; | |
}); | |
sizingCell.obj = obj; | |
CGSize size = [sizingCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; | |
return size.height; |
OlderNewer