Skip to content

Instantly share code, notes, and snippets.

View gist:62bb114f98048684faf0e0691cd6140b
//var s_ajaxListener = new Object();
//s_ajaxListener.tempOpen =;
//s_ajaxListener.tempSend = XMLHttpRequest.prototype.send;
// = function(a,b) {
// if (!a) var a='';
// if (!b) var b='';
View gist:ec4af17bb9630ce442ef6d8757662d40
//(function(Worker) {
// if (!Worker) {
// console.log('Web Worker not found.')
// return;
// }
// var postMessage = Worker.prototype.postMessage;
// Worker.prototype.postMessage = function(data) {
View CGRectInset
CGRectInset(self.view.bounds, 8.0, 0.0)
Returns a rectangle that is smaller or larger than the source rectangle, with the same center point.
A rectangle. The origin value is offset in the x-axis by the distance specified by the dx parameter and in the y-axis by the distance specified by the dy parameter, and its size adjusted by (2*dx,2*dy), relative to the source rectangle. If dx and dy are positive values, then the rectangle’s size is decreased. If dx and dy are negative values, the rectangle’s size is increased.
View gist:a9339809eca8dcdd1333013c1bc2a7d7
Reasoning behind this particular convention is that the pointer belongs to the instance and not the class. If you were to declare multiple variables on a single line, you'd expect each variable to have its own pointer like so:
NSArray *array1, *array2, *array3;
So we need to declare like this NSArray *array1
View scrollview magic
CGFloat height = CGRectGetHeight(scrollView.frame);
CGFloat contentYoffset = scrollView.contentOffset.y;
CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset;
View gist:d6638b6aef74b33a9a8afac3f4f27be7
git checkout -b test_brack_pr
git remote add brack
git fetch brack
git merge brack/cmshost
View CGGeometry
View gist:3c9f20d887505faa307ddb176fd8a337
row = [];// outer array
for (product in productsArray) {
innerArray = []; // inner array
if (product.image is large) {
array add product;
} else if (product image is small) {
把row 数组的最后一个拿出来,看看
如果只有一个,还是large image,我们就不管了
View gist:a4a892f8431cade9e39f
#ifdef DEBUG
@interface AFHTTPClient (Cheating)
@property (nonatomic, assign) BOOL allowsInvalidSSLCertificate;