Skip to content

Instantly share code, notes, and snippets.

@dhcdht
dhcdht / searchAndAddUUIDForXcodePlugin.py
Last active February 17, 2020 18:20
每次升级Xcode都要把插件们挨个升级才能用,很烦,其实它们大部分只需要在plist里边添加一个UUID而已,这个脚本可以帮你一次性升级Xcode plugin,不保证每个都能用
__author__ = 'dhcdht'
import os
import re
plugin_path = os.path.expanduser('~/Library/Application Support/Developer/Shared/Xcode/Plug-ins')
#for Xcode 6.3
#plugin_uuid = '9F75337B-21B4-4ADC-B558-F9CADF7073A7'
#for Xcode 6.3.2
#plugin_uuid = 'E969541F-E6F9-4D25-8158-72DC3545A6C6'
@alvesjtiago
alvesjtiago / NSInvocation+SimpleCreation.h
Created December 25, 2013 12:54
Create invocations the simple way. Extracted from ITActionManager.
//
// NSInvocation+SimpleCreation.h
// MAPI
//
// Created by Tiago Alves on 08/12/13.
// Copyright (c) 2013 Iterar. All rights reserved.
//
#import <Foundation/Foundation.h>
source ~/.bash_profile
cd ${SRCROOT}
/path/to/xctool.sh -reporter json-compilation-database:compile_commands.json clean
/path/to/xctool.sh -reporter json-compilation-database:compile_commands.json build
oclint-json-compilation-database | sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active March 10, 2024 19:23
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
@lqi
lqi / gist:5358513
Last active July 29, 2017 14:33 — forked from gavrix/gist:5054182
source ~/.bash_profile
hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
fi
cd ${TARGET_TEMP_DIR}
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@rudyjahchan
rudyjahchan / NSObject_Swizzle.h
Last active August 13, 2016 08:29
Monkey-Patching iOS with Objective-C Categories Part III: Swizzling
#import <Foundation/Foundation.h>
@interface NSObject (Swizzle)
+ (void)swizzleInstanceSelector:(SEL)originalSelector
withNewSelector:(SEL)newSelector;
@end
@dsibilly
dsibilly / NSString+UsefulShit.h
Created June 21, 2011 18:20
Objective-C category demonstration
//
// NSString+UsefulStuff.h
//
// Duane Sibilly <duane@sibilly.com>
// 6/21/11
// Copyright (c) 2011-2012 Duane Sibilly. All rights reserved.
#import <Foundation/Foundation.h>
// The use of the parenthesis in the interface declaration is what tells the
@danielphillips
danielphillips / UILabel+dynamicSizeMe.h
Created June 2, 2011 22:54
Adjust UILabel to change it's frame according to it's content
@interface UILabel (dynamicSizeMe)
-(float)resizeToFit;
-(float)expectedHeight;
@end