原创 JSPatch源碼剖析(一)

項目中使用到了JSPatch來實現線上APP bug的hot fix,使用後覺得JSPatch短小精悍並且功能強大,於是想往裏窺探下其實現機制。本文從JSPatch的使用角度去分析源碼。 JavaScript運行環境建立 Java

原创 iOS Tips(持續更新)

1. #import和@class 除非的確有必要,否則不要引入頭文件。一般來說,應該在某個類的頭文件中使用向前聲明來聲明別的類,並在實現文件中引入該類的頭文件。這樣做可以儘量降低類之間的耦合(coupling)。 有時無法使

原创 [LeetCode]81. Search in Rotated Sorted Array II

81. Search in Rotated Sorted Array II Follow up for “Search in Rotated Sorted Array”: What if duplicates are al

原创 [LeetCode]282. Expression Add Operators

282. Expression Add Operators Given a string that contains only digits 0-9 and a target value, return all possibil

原创 [LeetCode]128. Longest Consecutive Sequence

128. Longest Consecutive Sequence Given an unsorted array of integers, find the length of the longest consecutive

原创 [LeetCode]1. Two Sum

1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific targe

原创 [LeetCode]27. Remove Element

27. Remove Element Given an array and a value, remove all instances of that value in place and return the new leng

原创 [LeetCode]259. 3Sum Smaller

259. 3Sum Smaller Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0

原创 iOS APP瘦身技巧之第三方SDK瘦身

本人所開發的一款應用使用了ShareSDK第三方分享庫,該庫的體積嚇尿了,30MB+,並且只包含微信和新浪微博第三方分享功能,坑爹啊。於是決定砍掉ShareSDK,使用原生新浪微博SDK和微信SDK。既然目的是瘦身,那就要做得徹底

原创 幾個常用宏

懶加載宏 在創建各種子視圖時,我們習慣將這些子視圖定義爲對象屬性,然後通過屬性的獲取(getter)方法實現子視圖的懶加載。比如在控制器中我們需要創建一個自定會的子視圖,經常會這樣寫: - (UIView *)wrapperVie

原创 ios多線程編程知識小集

iOS爲開發者提供了豐富的多線程編程機制,從最直接最簡單的調用NSObject的performSelector系列API,到NSThread、Operation Queues以及Dispatch Queues,當然iOS也支持更原

原创 [LeetCode]33. Search in Rotated Sorted Array

33. Search in Rotated Sorted Array Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e

原创 [LeetCode]16. 3Sum Closest

16. 3Sum Closest Given an array S of n integers, find three integers in S such that the sum is closest to a given

原创 [LeetCode]4. Median of Two Sorted Arrays

4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the

原创 [LeetCode]60. Permutation Sequence

60. Permutation Sequence The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling