Skip to content

Instantly share code, notes, and snippets.

View k06a's full-sized avatar
๐Ÿš€
DeFi dreamer

Anton Bukov k06a

๐Ÿš€
DeFi dreamer
View GitHub Profile
@k06a
k06a / MLWAsyncAVPlayer.h
Last active September 7, 2023 11:51
Awesome optimized AVPlayer for smooth scrolling AVPlayerLayer inside UICollectionView/UITableView (tested on iOS10+)
#import <AVFoundation/AVFoundation.h>
@interface MLWAsyncAVPlayer : AVPlayer
@end
@k06a
k06a / AVPlayerItem+MLWPerformance.m
Last active September 7, 2023 11:51
Smooth AVPlayer scrolling in UICollectionView/UITableView
#import <JRSwizzle/JRSwizzle.h>
@implementation AVPlayerItem (MLWPerformance)
+ (void)load {
[AVPlayerItem jr_swizzleMethod:NSSelectorFromString(@"_attachToFigPlayer") withMethod:@selector(mlw_attachToFigPlayer) error:nil];
}
- (void)mlw_attachToFigPlayer {
static dispatch_queue_t queue = nil;
@k06a
k06a / WhenNoScrollingExecutor.m
Last active November 28, 2020 04:56
Executor performing blocks at least after 0.2 sec since last scrolling
static NSTimeInterval const kMinInactiveTime = 0.2;
//
@interface WhenNoScrollingExecutor : NSObject
@property (assign, nonatomic) BOOL runLoopModeWasUITrackingAgain;
- (void)executeBlock:(void (^)())block;
- (void)executeBlock:(void (^)())block completion:(void (^_Nullable)())completion;
@k06a
k06a / UILabel+FastTextColorChange.m
Created December 19, 2016 15:31
UIView to replace UILabel with ability to super fast change text color
@interface LabelMaskedView : UIView
@property (strong, nonatomic) UIView *maskView;
@property (assign, nonatomic) CGSize cachedIntrisincContentSize;
@end
@implementation LabelMaskedView
- (instancetype)initWitLabel:(UIView *)maskView {
@k06a
k06a / PuppyWatchdog
Last active November 13, 2016 12:38
Puppy Watchdog (1) on Medium.com
๐Ÿถ Main thread was blocked for 0.17 sec
๐Ÿถ Main thread is still blocked for 0.27 sec
๐Ÿถ Main thread is still blocked for 0.37 sec
๐Ÿถ Main thread is still blocked for 0.48 sec
๐Ÿถ Main thread is still blocked for 0.60 sec
๐Ÿถ Main thread is still blocked for 0.71 sec
๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ Collected 39 reports for 0.8 sec:
100.000% _start (in libdyld.dylib)
| 100.000% __mh_execute_header (in xctest)
| | 100.000% __XCTestMain (in XCTest)
@k06a
k06a / Active.m
Created November 9, 2016 20:21
Missing Anchors (3) on Medium.com
@[
@[
[statusBarBackground.edgesAnchor.withoutBottomAnchor constraintsEqualToConstant:UIEdgeInsetsZero],
[statusBarBackground.heightAnchor constraintEqualToConstant:kStatusBarBackgroundHeight],
],
@[
[commentLabel.centerYAnchor constraintEqualToAnchor:commentLabel.superView],
[commentLabel.leadingAnchor.withTrailingAnchor constraintsLessThanOrEqualToConstant:UIEdgeInsetsMake(0, kCommentLeading, 0, kCommentTrailing)],
],
@k06a
k06a / Active.m
Last active November 9, 2016 20:20
Missing Anchors (2) on Medium.com
@[
[statusBarBackground.edgesAnchor.withoutBottomAnchor constraintsEqualToConstant:UIEdgeInsetsZero],
[statusBarBackground.heightAnchor constraintEqualToConstant:kStatusBarBackgroundHeight],
].active = YES;
@[
[commentLabel.centerYAnchor constraintEqualToAnchor:commentLabel.superView],
[commentLabel.leadingAnchor.withTrailingAnchor constraintsLessThanOrEqualToConstant:UIEdgeInsetsMake(0, kCommentLeading, 0, kCommentTrailing)],
].active = YES;
@k06a
k06a / Anchors.m
Last active November 9, 2016 20:18
Missing Anchors (1) on Medium.com
[statusBarBackground.edgesAnchor.withoutBottomAnchor constraintsEqualToConstant:UIEdgeInsetsZero].active = YES;
[statusBarBackground.heightAnchor constraintEqualToConstant:kStatusBarBackgroundHeight];
[commentLabel.centerYAnchor constraintEqualToAnchor:commentLabel.superView].active = YES;
[commentLabel.leadingAnchor.withTrailingAnchor constraintsLessThanOrEqualToConstant:UIEdgeInsetsMake(0, kCommentLeading, 0, kCommentTrailing)].active = YES;
@k06a
k06a / gist:6ab1c52b6c0d63a659e46bfb414b8f92
Created September 9, 2016 09:21 — forked from podkovyrin/fix_xcode_plugins.sh
Update XCode plugins compatibility id
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
@k06a
k06a / AutolayoutTableView.m
Created August 9, 2016 07:08
UITableView subclass with autolayoutable header and footer
@interface AutolayoutTableView : UITableView
@end
@implementation AutolayoutTableView
- (void)layoutSubviews {
[super layoutSubviews];
// Dynamic sizing for the header view