Skip to content

Instantly share code, notes, and snippets.

View boylee1111's full-sized avatar
🎯
Focusing

Boyi (Elliot) Li boylee1111

🎯
Focusing
  • Google
  • Bay Area, CA
View GitHub Profile
@boylee1111
boylee1111 / checkThreadExitCondition
Last active August 29, 2015 14:19
Checking for an exit condition during a long job.
// From Apple official document
// https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Multithreading/CreatingThreads/CreatingThreads.html#//apple_ref/doc/uid/10000057i-CH15-SW15
- (void)threadMainRoutine
{
BOOL moreWorkToDo = YES;
BOOL exitNow = NO;
NSRunLoop* runLoop = [NSRunLoop currentRunLoop];
// Add the exitNow BOOL to the thread dictionary.
@boylee1111
boylee1111 / RefreshPluginsAfterXcodeUpgrading.sh
Last active June 24, 2016 03:24
Xcode升级插件兼容性问题修复,原Repo: https://github.com/cikelengfeng/RPAXU
#!/bin/bash
#获取当前版本Xcode的DVTPlugInCompatibilityUUID
UUID=$(defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID)
echo Xcode DVTPlugInCompatibilityUUID is $UUID
#遍历每一个Xcode插件,将UUID写入插件的兼容列表中
for MyPlugin in ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/*
do
defaults write "$MyPlugin"/Contents/Info DVTPlugInCompatibilityUUIDs -array-add $UUID
echo write DVTPlugInCompatibilityUUID to $MyPlugin succeed!
done
@boylee1111
boylee1111 / protocolEnumeration
Created April 3, 2015 10:25
A Swift Tour. Write an enumeration that conforms to this protocol.
protocol ExampleProtocol {
var simpleDescription: String { get }
mutating func adjust()
}
enum SimpleEnum : String, ExampleProtocol {
case Before = "", After = " (whatever)"
var simpleDescription: String {
get {
return "A simple enum." + self.rawValue