Skip to content

Instantly share code, notes, and snippets.

Pham Hoang Le namanhams

Block or report user

Report or block namanhams

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AnyPromise+Retry.md
+ (AnyPromise *) retry:(int)count delay:(NSTimeInterval)delay block:(AnyPromise *(^)(void))block {
    AnyPromise* (^attemp)(void) = ^AnyPromise*() {
        return block().catch(^(NSError *error) {
            if(count <= 1) {
                @throw error;
            }
            return PMKAfter(delay).then(^{
                return [AnyPromise retry:count-1 delay:delay block:block];
            });
@namanhams
namanhams / PFQuery+IsCache
Last active Aug 29, 2015
PFQuery+IsCache
View PFQuery+IsCache
typedef void (^fg_PFArrayResultBlock)(NSArray *PF_NULLABLE_S objects, NSError *PF_NULLABLE_S error, BOOL isCache, BOOL done);
@interface PFQuery (IsCache)
- (void)fg_findObjectsInBackgroundWithBlock:(PF_NULLABLE fg_PFArrayResultBlock)block
willLoadFromCache:(void (^ __nullable)())willLoadFromCache
willLoadFromNetwork:(void (^ __nullable)())willLoadFromNetwork;
@end
@implementation PFQuery (IsCache)
View UITextField+LeftMargin.swift
extension UITextField {
func setTextLeftPadding(left:CGFloat) {
var leftView:UIView = UIView(frame: CGRectMake(0, 0, left, 1))
leftView.backgroundColor = UIColor.clearColor()
self.leftView = leftView;
self.leftViewMode = UITextFieldViewMode.Always;
}
}
You can’t perform that action at this time.