Skip to content

Instantly share code, notes, and snippets.

@czwen
czwen / gist:c791e443b7751e0aaf4f
Created October 25, 2015 03:55
Xcode 7.1 Plug-ins not showing
run these 2 lines in terminal:
1:
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.plist DVTPlugInCompatibilityUUID
2:
defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-7.1
3:
restart xcode!
@czwen
czwen / gist:4080a359062d5bcef6d2
Created November 14, 2015 03:25
CATextLayer 字体模糊
CATextLayer *textLayer;
textLayer.contentsScale = 2;
@czwen
czwen / gist:033978056bb3d7b906dc
Created November 16, 2015 07:06
用逗号格式化number
- (NSString *)formatNumberDecimal{
if(self){
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = NSNumberFormatterDecimalStyle;
[formatter setMaximumFractionDigits:2];
NSString *string = @"0";
if([self multipleLongForNumber]){//long
string = [formatter stringFromNumber:[NSNumber numberWithLong:[self longValue]]];
}else{//double
string = [formatter stringFromNumber:[NSNumber numberWithDouble:[self doubleValue]]];
@czwen
czwen / gist:f93045169b058f24bc54
Created November 16, 2015 16:04
node.js problems
$node -v
dyld: bad external relocation length
[1] 46368 trace trap node -v
$ sudo n latest
@czwen
czwen / gist:97e4d7b39d19e275cf6a
Created November 30, 2015 08:26
fuck when UIRefreshControl refresh manually but the tintcolor not change
[UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^(void){
self.tableView.contentOffset = CGPointMake(0, -self.refresh.frame.size.height);
} completion:^(BOOL finished) {
[self.refresh beginRefreshing];
[self loadProductsList];
}];
@czwen
czwen / gist:921113eb3435e58eb3b6
Created December 1, 2015 07:59
根据commit生成build号
git=`sh /etc/profile; which git`
appBuild=`"$git" rev-list --count HEAD`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
echo "Updated ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
@czwen
czwen / gist:99318ea77b8651f87cdf
Created January 5, 2016 05:57
UITableViewCell set zero separator inset
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
// Remove seperator inset
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
// Prevent the cell from inheriting the Table View's margin settings
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
@czwen
czwen / gist:eddb5346fb1d778d9361
Created January 16, 2016 08:57
hide tableview search bar when init
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
CGPoint contentOffset = self.tableView.contentOffset;
contentOffset.y += CGRectGetHeight(self.tableView.tableHeaderView.frame);
self.tableView.contentOffset = contentOffset;
}
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
@czwen
czwen / gist:bf6ad74399377bc9701c
Created March 1, 2016 07:20
uiviewcontroller 删除backbutton title
UINavigationItem *item = self.navigationController.navigationBar.topItem;
item.title = @"";
@czwen
czwen / Xcode Show Build Operation Duration
Created March 11, 2016 07:06
Xcode Show Build Operation Duration
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES