Skip to content

Instantly share code, notes, and snippets.

@gliubc
gliubc / .txt
Created June 14, 2018 00:57
AppCode configuration file path
Configuration (idea.config.path):
~/Library/Preferences/<PRODUCT><VERSION>
Caches (idea.system.path):
~/Library/Caches/<PRODUCT><VERSION>
Plugins (idea.plugins.path):
~/Library/Application Support/<PRODUCT><VERSION>
Logs (idea.log.path):
~/Library/Logs/<PRODUCT><VERSION>
@gliubc
gliubc / .m
Created June 14, 2018 00:58
DLog
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
# define DLog(...)
#endif
@gliubc
gliubc / .m
Created June 14, 2018 01:02
viewDidLayoutSubviews
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
DLog(@"%@", NSStringFromCGRect(self.button.frame));
DLog(@"%@", NSStringFromCGRect(self.label.frame));
}
@gliubc
gliubc / .txt
Last active December 30, 2018 05:26
In your Genymotion Android emulator…
Settings -> Wifi -> Press and hold your active network
Select “Modify Network”
Select “Show Advanced Options”
Select “Proxy Settings -> Manual”
Set your Proxy to: 10.0.3.2 (Genymotion’s special code for the local workstation)
Set your Port to: 8888
Press Save
@gliubc
gliubc / .txt
Created June 14, 2018 01:04
tcpdump
tcpdump -s 0 -A 'tcp dst port 80 and (tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354)'
@gliubc
gliubc / .m
Last active June 21, 2018 08:22
UITapGestureRecognizer
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleMenuTap:)];
[menu addGestureRecognizer:recognizer];
- (void)handleMenuTap:(UITapGestureRecognizer *)recognizer {
[self selectTabAtIndex:recognizer.view.tag];
}
@gliubc
gliubc / .m
Last active June 14, 2018 03:19
animateWithDuration
[UIView animateWithDuration:0.3f animations:^{
self.tabMenuIndicator.frame = CGRectMake(200, 0, 50, 5);
}];
- (void)showFilter {
self.mainVC.viewFilterMask.hidden = NO;
self.mainVC.viewFilterMask.alpha = 0;
@gliubc
gliubc / .m
Created June 14, 2018 01:33
scrollRectToVisible
CGRect menuScrollViewRect = CGRectMake(
menuRect.origin.x - (tabMenuRect.size.width - menuRect.size.width) / 2,
menuRect.origin.y,
tabMenuRect.size.width,
tabMenuRect.size.height
);
[menuScrollView scrollRectToVisible:menuScrollViewRect animated:YES];
@gliubc
gliubc / .m
Created June 14, 2018 01:36
automaticallyAdjustsScrollViewInsets
self.automaticallyAdjustsScrollViewInsets = NO;
@gliubc
gliubc / .m
Last active October 8, 2019 05:44
self.tabMenuFont = [UIFont systemFontOfSize:16];
self.tabMenuSelectedFont = [UIFont systemFontOfSize:16];
self.tabMenuColor = HEXCOLOR(0xA1A3A8);
self.tabMenuSelectedColor = HEXCOLOR(0x333333);
self.tabMenuPadding = 0;
self.tabMenuMinimumPadding = 0;
self.tabMenuIndicatorHeight = 2;
self.tabMenuIndicatorColor = HEXCOLOR(0xF74443);
self.tabMenuIndicatorRadius = 1;
self.tabMenuIndicatorWidth = 0;