Skip to content

Instantly share code, notes, and snippets.

@maxhuk
maxhuk / UILabel+SizeToFit.h
Created April 8, 2013 11:37
A simple way to adjust the size of an UILabel to fit its contents by changing height only. Supports attributed strings.
//
// UILabel+SizeToFit.h
//
// Created by Maksym Huk on 4/4/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UILabel (SizeToFit)
@maxhuk
maxhuk / NSTimer+WeakTarget.h
Created April 8, 2013 11:41
A simple way to create or schedule a timer that doesn't retain its target.
//
// NSTimer+WeakTarget.h
//
// Created by Maksym Huk on 4/8/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSTimer (WeakTarget)
@maxhuk
maxhuk / UUID.h
Created April 9, 2013 09:23
UUID string generator.
//
// UUID.h
//
// Created by Maksym Huk on 3/20/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import <Foundation/Foundation.h>
extern NSString *GenerateUUID();
@maxhuk
maxhuk / LumberjackSettings.h
Created April 9, 2013 09:37
Template initialize for Lumberjack framework.
//
// LumberjackSettings.h
//
// Created by Maksym Huk on 2/11/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import "DDLog.h"
enum {
@maxhuk
maxhuk / NSNotificationCenter+Macros.h
Created April 9, 2013 09:42
Useful macros for working with notifications.
//
// NSNotificationCenter+Macros.h
//
// Created by Maksym Huk on 3/31/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#define NOTIFICATION_H(x) extern NSString * const x;
#define NOTIFICATION_M(x) NSString * const x = @#x;
#define OBSERVE_NOTIFICATION(notificationName, sel) [[NSNotificationCenter defaultCenter] addObserver:self selector:sel name:notificationName object:nil]
@maxhuk
maxhuk / NSNotificationCenter+GCD.h
Created April 9, 2013 09:45
Useful when sending notifications from a worker queue.
//
// NSNotificationCenter+GCD.h
//
// Created by Maksym Huk on 10/30/12.
// Copyright (c) 2012 Maksym Huk. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSNotificationCenter (GCD)
@maxhuk
maxhuk / MBProgressHUD+ActivityBlock.h
Created April 9, 2013 10:12
Full activity block using MBProgressHUD.
//
// MBProgressHUD+ActivityBlock.h
//
// Created by Maksym Huk on 4/1/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import "MBProgressHUD.h"
@interface MBProgressHUD (ActivityBlock)
@maxhuk
maxhuk / NSString+DateFormatter.h
Created April 9, 2013 10:13
Fast date formatting.
//
// NSString+DateFormatter.h
//
// Created by Maksym Huk on 3/31/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import <Foundation/Foundation.h>
#define DateFormatDate @"yyyy-MM-dd"
@maxhuk
maxhuk / NSAttributedString+Compose.h
Created April 9, 2013 10:15
Comfortable multi-part NSAttributedString composition.
//
// NSAttributedString+Compose.h
//
// Created by Maksym Huk on 3/31/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSAttributedString (Compose)
@maxhuk
maxhuk / AppDirectories.h
Created April 9, 2013 10:16
Fast path composition for common file locations.
//
// AppDirectories.h
//
// Created by Maksym Huk on 3/31/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import <Foundation/Foundation.h>
NSString *AppendToDocumentsDirectory(NSString *path);