diff --git a/CodeSnippets/20888CE5-13E0-4B11-9BE3-4EEEB93DB277.codesnippet b/CodeSnippets/20888CE5-13E0-4B11-9BE3-4EEEB93DB277.codesnippet
index a4f21a33..fbcd3f57 100644
--- a/CodeSnippets/20888CE5-13E0-4B11-9BE3-4EEEB93DB277.codesnippet
+++ b/CodeSnippets/20888CE5-13E0-4B11-9BE3-4EEEB93DB277.codesnippet
@@ -29,7 +29,7 @@
#define UI_NAVIGATION_BAR_HEIGHT 44
#define UI_TAB_BAR_HEIGHT 49
#define UI_STATUS_BAR_HEIGHT 20
-#define UI_SCREEN_WIDTH 320
+#define UI_SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.weight)
#define UI_SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define UI_LABEL_LENGTH 200
diff --git a/CodeSnippets/45D5535E-44FA-491F-8E4B-3251A46D5372.codesnippet b/CodeSnippets/45D5535E-44FA-491F-8E4B-3251A46D5372.codesnippet
index f62d13ae..db5e58bc 100644
--- a/CodeSnippets/45D5535E-44FA-491F-8E4B-3251A46D5372.codesnippet
+++ b/CodeSnippets/45D5535E-44FA-491F-8E4B-3251A46D5372.codesnippet
@@ -9,7 +9,7 @@
ClassImplementation
IDECodeSnippetContents
- + (<#ClassName#> *)sharedInstance
+ + (instancetype)sharedInstance
{
static id sharedInstance = nil;
static dispatch_once_t onceToken;
diff --git a/CodeSnippets/7707FE2A-C6CF-4774-8A7D-EA6BEE058C11.codesnippet b/CodeSnippets/7707FE2A-C6CF-4774-8A7D-EA6BEE058C11.codesnippet
index 3224f9a1..3e96b3fb 100644
--- a/CodeSnippets/7707FE2A-C6CF-4774-8A7D-EA6BEE058C11.codesnippet
+++ b/CodeSnippets/7707FE2A-C6CF-4774-8A7D-EA6BEE058C11.codesnippet
@@ -6,10 +6,10 @@
aaa
IDECodeSnippetCompletionScopes
- ClassInterfaceMethods
+ All
IDECodeSnippetContents
- @property (assign, nonatomic) <#type#> <#name#>
+ @property (nonatomic) <#type#> <#name#>;
IDECodeSnippetIdentifier
7707FE2A-C6CF-4774-8A7D-EA6BEE058C11
IDECodeSnippetLanguage
diff --git a/CodeSnippets/A807145A-F6BD-412C-AA06-DC931E43F730.codesnippet b/CodeSnippets/A807145A-F6BD-412C-AA06-DC931E43F730.codesnippet
new file mode 100644
index 00000000..4701e554
--- /dev/null
+++ b/CodeSnippets/A807145A-F6BD-412C-AA06-DC931E43F730.codesnippet
@@ -0,0 +1,30 @@
+
+
+
+
+ IDECodeSnippetCompletionPrefix
+ tq_hide_keyboard
+ IDECodeSnippetCompletionScopes
+
+ ClassImplementation
+
+ IDECodeSnippetContents
+ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+ [super touchesBegan:touches withEvent:event];
+ [self.view endEditing:YES];
+}
+
+ IDECodeSnippetIdentifier
+ A807145A-F6BD-412C-AA06-DC931E43F730
+ IDECodeSnippetLanguage
+ Xcode.SourceCodeLanguage.Objective-C
+ IDECodeSnippetSummary
+ hide keyboard when touch background
+ IDECodeSnippetTitle
+ hide keyboard
+ IDECodeSnippetUserSnippet
+
+ IDECodeSnippetVersion
+ 2
+
+
diff --git a/CodeSnippets/A83AE4CD-E79A-464F-B849-29BEB3CF4B01.codesnippet b/CodeSnippets/A83AE4CD-E79A-464F-B849-29BEB3CF4B01.codesnippet
index 6f035004..7f6aa7db 100644
--- a/CodeSnippets/A83AE4CD-E79A-464F-B849-29BEB3CF4B01.codesnippet
+++ b/CodeSnippets/A83AE4CD-E79A-464F-B849-29BEB3CF4B01.codesnippet
@@ -9,7 +9,7 @@
All
IDECodeSnippetContents
- @property (strong, nonatomic) <#type#> * <#name#>;
+ @property (strong, nonatomic) <#type#> *<#name#>;
IDECodeSnippetIdentifier
A83AE4CD-E79A-464F-B849-29BEB3CF4B01
IDECodeSnippetLanguage
@@ -17,7 +17,7 @@
IDECodeSnippetSummary
strong type property
IDECodeSnippetTitle
- strong type property
+ tq strong type property
IDECodeSnippetUserSnippet
IDECodeSnippetVersion
diff --git a/CodeSnippets/B564B787-4757-4E8E-A8A2-1299CE7B5420.codesnippet b/CodeSnippets/B564B787-4757-4E8E-A8A2-1299CE7B5420.codesnippet
new file mode 100644
index 00000000..0aae6aac
--- /dev/null
+++ b/CodeSnippets/B564B787-4757-4E8E-A8A2-1299CE7B5420.codesnippet
@@ -0,0 +1,41 @@
+
+
+
+
+ IDECodeSnippetCompletionPrefix
+ tq_ape_ui_common
+ IDECodeSnippetCompletionScopes
+
+ ClassImplementation
+
+ IDECodeSnippetContents
+ - (void)viewDidLoad {
+ [super viewDidLoad];
+ self.view.backgroundColor = VIEW_BG_COLOR;
+ UIView * headerView = [HeaderUtils addCustomHeaderToView:self.view];
+ UIButton * returnButton = [HeaderUtils addCustomReturnButtonToView:headerView];
+ [returnButton addTouchTarget:self action:@selector(returnButtonPressed:)];
+ [HeaderUtils addTitleLabelToView:headerView].text = @"<#title#>";
+
+ [HeaderUtils addHeaderShadowToView:self.view];
+}
+
+- (void)viewDidUnload {
+ [super viewDidUnload];
+}
+
+
+ IDECodeSnippetIdentifier
+ B564B787-4757-4E8E-A8A2-1299CE7B5420
+ IDECodeSnippetLanguage
+ Xcode.SourceCodeLanguage.Objective-C
+ IDECodeSnippetSummary
+ tq ape ui common
+ IDECodeSnippetTitle
+ tq_ape_ui_common
+ IDECodeSnippetUserSnippet
+
+ IDECodeSnippetVersion
+ 2
+
+
diff --git a/CodeSnippets/E10BEAE2-7433-4892-9314-95759F276395.codesnippet b/CodeSnippets/E10BEAE2-7433-4892-9314-95759F276395.codesnippet
index 20dc0b5f..85c30dc3 100644
--- a/CodeSnippets/E10BEAE2-7433-4892-9314-95759F276395.codesnippet
+++ b/CodeSnippets/E10BEAE2-7433-4892-9314-95759F276395.codesnippet
@@ -9,7 +9,7 @@
ClassInterfaceMethods
IDECodeSnippetContents
- @property (weak, nonatomic) <#type#> * <#name#>;
+ @property (weak, nonatomic) <#type#> *<#name#>;
IDECodeSnippetIdentifier
E10BEAE2-7433-4892-9314-95759F276395
IDECodeSnippetLanguage
diff --git a/Shells/convertImage.sh b/Shells/convertImage.sh
new file mode 100755
index 00000000..01b83afc
--- /dev/null
+++ b/Shells/convertImage.sh
@@ -0,0 +1,45 @@
+#! /bin/bash
+
+# print usage
+usage() {
+ cat << EOF
+ Usage:
+ convertImage.sh
+EOF
+}
+
+if [ $# -ne 2 ]; then
+ usage
+ exit 1
+fi
+
+SRC_DIR=$1
+DEST_DIR=$2
+
+# check src dir
+if [ ! -d $SRC_DIR ]; then
+ echo "src directory not exist: $SRC_DIR"
+ exit 1
+fi
+
+# check dest dir
+if [ ! -d $DEST_DIR ]; then
+ mkdir -p $DEST_DIR
+fi
+
+for src_file in $SRC_DIR/*.* ; do
+ echo "process file name: $src_file"
+ # 获得去掉文件名的纯路径
+ src_path=`dirname $src_file`
+ # 获得去掉路径的纯文件名
+ filename=`basename $src_file`
+ # 获得文件名字(不包括扩展名)
+ name=`echo "$filename" | cut -d'.' -f1`
+ # remove @2x in filename if there is
+ name=`echo "$name" | cut -d"@" -f1`
+ # 获得文件扩展名
+ extension=`echo "$filename" | cut -d'.' -f2`
+ dest_file="$DEST_DIR/${name}.${extension}"
+
+ convert $src_file -resize 50% $dest_file
+done
diff --git a/Shells/dailyBuild.sh b/Shells/dailyBuild.sh
new file mode 100755
index 00000000..0e12d48a
--- /dev/null
+++ b/Shells/dailyBuild.sh
@@ -0,0 +1,308 @@
+#!/bin/bash
+#
+# This is the daily build script for an iOS project.
+#
+# Author: Tang Qiao
+#
+
+function usage() {
+ echo "Usage:"
+ echo " dailyBuild.sh [target] [server] [tag]"
+ echo "Argument:"
+ echo " target - the build target name"
+ echo " server - the server type, valid value are 'test_www', 'test_ape', 'online_ape' and 'online' "
+ echo " tag - optional. if tag is not empty, the ipa file will be put the tags directory instead of year/month directory"
+ echo "Example:"
+ echo " dailyBuild.sh Ape_kyzz test_www"
+ echo " dailyBuild.sh Ape_kyzz test_ape"
+ echo " dailyBuild.sh Ape_kyzz online_ape"
+ echo " dailyBuild.sh Ape_kyzz online"
+ echo ""
+ echo "Tag Example:"
+ echo " dailyBuild.sh Ape_kyzz test_www iPhone_1.0.0"
+ exit 1
+}
+
+function processIcon() {
+ echo "process icon: $1"
+ targetIcon=$1
+ if [[ ! -f $targetIcon ]]; then
+ echo "$targetIcon is not exist"
+ return
+ fi
+ width=`identify -format %w ${targetIcon}`
+ build_date=$(date +%y%m%d)
+ convert -background '#0008' -fill white -gravity center -size %${width}x40\
+ caption:"${ICON_NAME} ${build_date}"\
+ ${targetIcon} +swap -gravity south -composite ${targetIcon}
+}
+
+function checkDependency() {
+ command -v convert >/dev/null 2>&1 || { echo "please: brew install imagemagick" >&2; exit 1; }
+ command -v identify >/dev/null 2>&1 || { echo "please: brew install ghostscript" >&2; exit 1; }
+}
+
+
+if [ $# -lt 2 ]; then
+ usage
+fi
+
+checkDependency
+
+TARGET=$1
+SERVER=$2
+TAG_NAME=$3
+
+OUTPUT_PATH="fenbi@192.168.0.102:/var/www/apps/"
+HTTP_TARGET="http://app.zhenguanyu.com"
+
+PROJECT_HOME=`pwd`
+BUILD_PATH="$PROJECT_HOME/build"
+FOLDER_PREFIX="iphone"
+
+# get bundle id
+PROJECT_PLIST=`find . -type f -name "${TARGET}-Info.plist" -depth 2`
+BUNDLE_ID=`grep "com.fenbi" $PROJECT_PLIST | head -1`
+# remove the prefix and suffix and trim blankspaces
+BUNDLE_ID=${BUNDLE_ID#*string>}
+BUNDLE_ID=${BUNDLE_ID%*}
+if [ "$BUNDLE_ID" != "" ]; then
+ echo "bundle id = $BUNDLE_ID"
+else
+ echo "bundle id is not found"
+ exit 1
+fi
+
+## clear old data
+cd $PROJECT_HOME
+rm -rf $BUILD_PATH
+
+## set configuration
+CONFIGURATION=""
+ICON_NAME=""
+if [ $SERVER == "test_www" ]; then
+ CONFIGURATION="Debug_www"
+ ICON_NAME="twww"
+elif [ $SERVER == "test_ape" ]; then
+ CONFIGURATION="Debug_ape"
+ ICON_NAME="tape"
+elif [ $SERVER == "online_ape" ]; then
+ CONFIGURATION="Online_ape"
+ ICON_NAME="oape"
+elif [ $SERVER == "online" ]; then
+ CONFIGURATION="Online"
+ ICON_NAME="owww"
+else
+ echo "CONFIGURATION is not valid"
+ usage
+ exit 1
+fi
+
+## set .git log info
+if [[ -d "$PROJECT_HOME/.git" ]]; then
+ GIT_VERSION=$(git log --oneline -1 | cut -d" " -f1)
+ COMMIT_LOG=`git log -7`
+fi
+echo "GIT_VERSION = $GIT_VERSION"
+
+# mark build info to icon file
+ICON_DONE="NO"
+echo "mark build info to icon files..."
+for file in $( find $TARGET -type f -name "Icon*.png" )
+do
+ processIcon $file
+ ICON_DONE="YES"
+done
+if [[ "$ICON_DONE" == "NO" ]]; then
+ for file in $( find . -type f -name "Icon*.png" )
+ do
+ processIcon $file
+ done
+fi
+
+## build
+echo "building...it will take several minutes."
+xcodebuild -configuration $CONFIGURATION -target "$TARGET" > /dev/null
+BUILD_RES=$?
+
+
+# mark build info to icon file
+echo "recovery icon files..."
+if [[ "$ICON_DONE" == "NO" ]]; then
+ for file in $( find . -not -path "./build/*" -type f -name "Icon*.png" )
+ do
+ git checkout $file
+ done
+else
+ for file in $( find $TARGET -type f -name "Icon*.png" )
+ do
+ git checkout $file
+ done
+fi
+
+## check result
+echo "BUILD_RES=$BUILD_RES"
+if [ $BUILD_RES -ne 0 ]; then
+ echo "Failed to build dailyBuild"
+ exit 1
+fi
+
+if [ ! -d "$BUILD_PATH/${CONFIGURATION}-iphoneos" ]; then
+ echo "${CONFIGURATION}-iphoneos directory is not exist"
+ exit 1
+fi
+
+# get file name
+PRODUCT_NAME=`find build -type dir -name "*.app"`
+PRODUCT_NAME=`basename $PRODUCT_NAME`
+if [ $PRODUCT_NAME == "" ]; then
+ echo "can not get product name"
+ exit 1
+fi
+
+
+# create ipa folder
+FILE_NAME="${TARGET}_$(date +%y%m%d-%H%M)_r${GIT_VERSION}.ipa"
+echo "build file using specified name: $FILE_NAME"
+
+cd $BUILD_PATH
+mkdir -p ipa/Payload
+cp -r ./${CONFIGURATION}-iphoneos/$PRODUCT_NAME ./ipa/Payload/
+
+# create ipa file
+echo "creating $FILE_NAME"
+cd ipa
+zip -rq $FILE_NAME *
+
+# create dSYM file
+echo "creating dSYM.zip"
+cd $BUILD_PATH/${CONFIGURATION}-iphoneos/
+zip -rq dSYM.zip ${PRODUCT_NAME}.dSYM
+
+# generate output folder
+if [ "${TAG_NAME}" == "" ]; then
+ YEAR=$(date +%Y)
+ MONTH=$(date +%m)
+ FOLDER="${FOLDER_PREFIX}/${TARGET}/${YEAR}/${MONTH}/${TARGET}_${SERVER}_$(date +%y%m%d-%H%M)"
+else
+ FOLDER="${FOLDER_PREFIX}/${TARGET}/tags/${TARGET}_${SERVER}_${TAG_NAME}"
+fi
+echo "Output folder=${FOLDER}"
+
+# copy ipa & dsym
+
+cd $BUILD_PATH
+mkdir -p $FOLDER
+cp ipa/$FILE_NAME $FOLDER/
+cp ${CONFIGURATION}-iphoneos/dSYM.zip $FOLDER/
+
+# copy icon
+ICON_FILE=`find . -type f -name "[iI]con.png" | head -1`
+if [ "$ICON_FILE" == "" ]; then
+ echo "icon file is not exit"
+ exit 1
+fi
+cp $ICON_FILE $FOLDER/icon.png
+
+# Create install html
+cd $FOLDER
+PLIST_PATH="/${FOLDER}/appInfo.plist"
+# ${str//apple/APPLE} # 替换所有apple,这里的apple是/,被转义成\/
+PLIST_PATH=${PLIST_PATH//\//%2f}
+cat << EOF > index.html
+
+
+
+
+ 安装此软件
+
+
+
+ $PRODUCT_NAME Daily Build
+
+
+
+
+
+
+
+
+ 最近的提交Log:
+
$COMMIT_LOG
+
+
+
+EOF
+
+cat << EOF > appInfo.plist
+
+
+
+
+ items
+
+
+ assets
+
+
+ kind
+ software-package
+ url
+ ${HTTP_TARGET}/${FOLDER}/$FILE_NAME
+
+
+ kind
+ display-image
+ needs-shine
+
+ url
+ ${HTTP_TARGET}/${FOLDER}/icon.png
+
+
+ kind
+ full-size-image
+ needs-shine
+
+ url
+ ${HTTP_TARGET}/${FOLDER}/icon.png
+
+ metadata
+
+ bundle-identifier
+ $BUNDLE_ID
+ bundle-version
+ 1.0
+ kind
+ software
+ subtitle
+ $PRODUCT_NAME
+ title
+ $PRODUCT_NAME
+
+
+
+
+
+
+EOF
+
+# create latest link
+
+cd "$BUILD_PATH/$FOLDER_PREFIX/$TARGET"
+mkdir latest
+find . -type f -name "appInfo.plist" | xargs -J % cp % latest/
+
+cd $BUILD_PATH
+
+if [ "$OUTPUT_PATH" != "" ]; then
+ scp -r $FOLDER_PREFIX ${OUTPUT_PATH}
+fi
+
+
+echo "Daily build for $PRODUCT_NAME completed!"
diff --git a/clear_derived_data.sh b/clear_derived_data.sh
index bf3e1b0e..6ffa04b9 100755
--- a/clear_derived_data.sh
+++ b/clear_derived_data.sh
@@ -1,6 +1,6 @@
#! /bin/bash
-cd /Users/tangqiao/Library/Developer/Xcode/DerivedData
+cd ~/Library/Developer/Xcode/DerivedData
rm -rf *
echo "done"
diff --git a/git b/git
new file mode 100644
index 00000000..e69de29b
diff --git a/open_plugin_path.sh b/open_plugin_path.sh
new file mode 100755
index 00000000..cb02ab89
--- /dev/null
+++ b/open_plugin_path.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+open ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins
+
diff --git a/setup_reveal.sh b/setup_reveal.sh
new file mode 100755
index 00000000..1ddc7097
--- /dev/null
+++ b/setup_reveal.sh
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+cat << EOF > ~/.lldbinit
+command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
+command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
+command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
+command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
+
+EOF
+
+echo "done"