<|start_filename|>UsefulBits/Security/NSMutableDictionary+PasswordManager.h<|end_filename|>
//
//  NSMutableDictionary+PasswordManager.h
//  UsefulBits
//
//  Created by <NAME> on 30/12/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSMutableDictionary (PasswordManager)

+ (id)passwordQueryForService:(NSString *)service account:(NSString *)account;

@end


<|start_filename|>UsefulBits/Foundation/NSArray+Zip.h<|end_filename|>
//
//  NSArray+Zip.h
//  UsefulBits
//
//  Created by <NAME> on 4/09/11.
//  Copyright 2011 <NAME>. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSArray (Zip)

- (NSArray *)zip:(NSArray *)other;
- (NSArray *)flatten;

@end


<|start_filename|>UsefulBits/UIKit/UIView+Skin.h<|end_filename|>
//
//  UIView+Skin.h
//  UsefulBits
//
//  Created by <NAME> on 27/04/12.
//

#import <UIKit/UIKit.h>

#import "UsefulBits/Skin.h"

@interface UIView (Skin)

- (id)initWithFrame:(CGRect)frame skin:(Skin *)skin;
- (void)styleWithSkin:(Skin *)skin;

@end


<|start_filename|>UsefulBits/Foundation/NSDictionary+Blocks.h<|end_filename|>
//
//  NSDictionary+Blocks.h
//  UsefulBits
//
//  Created by <NAME> on 25/11/11.
//

#import <Foundation/Foundation.h>

@interface NSDictionary (Blocks)

- (void)each:(void (^) (id key, id value))action;
- (NSArray *)map:(id (^) (id key, id value))action;

- (NSDictionary *)transform:(id (^) (id key, id value))action filterNil:(BOOL)filterNil;
- (NSDictionary *)transform:(id (^) (id key, id value))action;

- (void)withValueForKey:(id)key meetingCondition:(BOOL (^) (id value))condition do:(void (^) (id value))action;

- (void)withValueForKey:(id)key meetingCondition:(BOOL (^) (id value))condition do:(void (^) (id value))action default:(void (^) (void))default_action;

- (void)withValueForKey:(id)key ofClass:(Class)class do:(void (^) (id value))action;
- (void)withValueForKey:(id)key ofClass:(Class)class do:(void (^) (id value))action default:(void (^) (void))default_action;

- (void)withValueForKey:(id)key do:(void (^) (id value))action;
- (void)withValueForKey:(id)key do:(void (^) (id value))action default:(void (^) (void))default_action;

- (NSDictionary *)pick:(BOOL (^) (id key, id value))filter;
- (NSDictionary *)filter:(BOOL (^) (id key, id value))filter;

- (void)withStringForKey:(id)key do:(void (^) (NSString *value))action;
- (void)withStringForKey:(id)key do:(void (^) (NSString *value))action default:(void (^) (void))default_action;

- (void)withNumberForKey:(id)key do:(void (^) (NSNumber *value))action;
- (void)withNumberForKey:(id)key do:(void (^) (NSNumber *value))action default:(void (^) (void))default_action;

- (void)withDictionaryForKey:(id)key do:(void (^) (NSDictionary *value))action;
- (void)withDictionaryForKey:(id)key do:(void (^) (NSDictionary *value))action default:(void (^) (void))default_action;

- (void)withArrayForKey:(id)key do:(void (^) (NSArray *value))action;
- (void)withArrayForKey:(id)key do:(void (^) (NSArray *value))action default:(void (^) (void))default_action;

@end


<|start_filename|>UsefulBits/Security/PasswordManager.h<|end_filename|>
//
//  PasswordManager.h
//  UsefulBits
//
//  Created by <NAME> on 30/12/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface PasswordManager : NSObject

+ (BOOL)storePassword:(NSString *)password forAccount:(NSString *)account;
+ (NSString *)passwordForAccount:(NSString *)account;
+ (BOOL)removePasswordForAccount:(NSString *)account;

@end


<|start_filename|>UsefulBits/Foundation/Foundation+UsefulBits.h<|end_filename|>
  //  Copyright (c) 2011, <NAME>
  //  All rights reserved.
  //
  //  Redistribution and use in source and binary forms, with or without
  //  modification, are permitted provided that the following conditions are met:
  //
  //  * Redistributions of source code must retain the above copyright
  //   notice, this list of conditions and the following disclaimer.
  //
  //  * Redistributions in binary form must reproduce the above copyright
  //   notice, this list of conditions and the following disclaimer in the
  //   documentation and/or other materials provided with the distribution.
  //
  //  * Neither the name UsefulBits nor the names of its contributors may be used
  //   to endorse or promote products derived from this software without specific
  //   prior written permission.
  //
  //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  //  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  //  DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  //  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  //  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  //  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  //  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  //  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  //  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#import <UsefulBits/UBMacros.h>
#import <UsefulBits/UBFoundationFunctions.h>
#import <UsefulBits/NSArray+Blocks.h>
#import <UsefulBits/NSArray+Zip.h>
#import <UsefulBits/NSSet+Blocks.h>
#import <UsefulBits/NSSet+Intersection.h>
#import <UsefulBits/NSLock+Blocks.h>
#import <UsefulBits/NSArray+Access.h>
#import <UsefulBits/NSObject+Blocks.h>
#import <UsefulBits/NSDictionary+URLParams.h>
#import <UsefulBits/NSObject+Creation.h>
#import <UsefulBits/NSOperationQueue+WorkerQueue.h>
#import <UsefulBits/NSString+URLEncode.h>
#import <UsefulBits/NSURL+Parameters.h>
#import <UsefulBits/NSDictionary+Types.h>
#import <UsefulBits/NSDictionary+Blocks.h>
#import <UsefulBits/NSNumber+Hex.h>
#import <UsefulBits/NSDictionary+Intersection.h>
#import <UsefulBits/NSMutableDictionary+ConditionalSet.h>



<|start_filename|>UsefulBits/Foundation/UBMacros.h<|end_filename|>
  //  Copyright (c) 2011, <NAME>
  //  All rights reserved.
  //
  //  Redistribution and use in source and binary forms, with or without
  //  modification, are permitted provided that the following conditions are met:
  //
  //  * Redistributions of source code must retain the above copyright
  //   notice, this list of conditions and the following disclaimer.
  //
  //  * Redistributions in binary form must reproduce the above copyright
  //   notice, this list of conditions and the following disclaimer in the
  //   documentation and/or other materials provided with the distribution.
  //
  //  * Neither the name UsefulBits nor the names of its contributors may be used
  //   to endorse or promote products derived from this software without specific
  //   prior written permission.
  //
  //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  //  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  //  DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  //  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  //  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  //  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  //  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  //  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  //  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#ifdef DEBUG
#define IS_DEBUG   1
#define IS_RELEASE 0
#else
#define IS_DEBUG   0
#define IS_RELEASE 1
#endif

#define UBRELEASE_NIL(INSTANCE__)      { [INSTANCE__ release]; INSTANCE__ = nil; }
#define UBRELEASE_DEADBABE(INSTANCE__) { [INSTANCE__ release]; *((uint *) &INSTANCE__) = 0xDEADBABE; }

#if IS_DEBUG
#define UBRELEASE(INSTANCE__) UBRELEASE_DEADBABE(INSTANCE__)
#else
#define UBRELEASE(INSTANCE__) UBRELEASE_NIL(INSTANCE__)
#endif

#define UBSWAP_INSTANCE_RETAIN(DESTINATION__, SOURCE__) \
{                                                   \
  id old_value__ = DESTINATION__;                   \
  DESTINATION__ = [(SOURCE__) retain];              \
  [old_value__ release];                            \
}

#define UBSWAP_INSTANCE_COPY(DESTINATION__, SOURCE__) \
{                                                 \
  id old_value__ = DESTINATION__;                 \
  DESTINATION__ = [(SOURCE__) copy];              \
  [old_value__ release];                          \
}

#if defined(__GNUC__) && !defined(__STRICT_ANSI__)

#define UBCLAMP(VALUE__, MIN__, MAX__) ({\
  __typeof__(VALUE__) upper_value__ = MAX((MIN__), (VALUE__)); MIN((MAX__), upper_value__); \
})

#else

#define UBCLAMP(VALUE__, MIN__, MAX__) \
  MIN((MAX__), MAX((MIN__), (VALUE__)))

#endif


<|start_filename|>UsefulBits/UIKit/ViewDecorators.h<|end_filename|>
//  Copyright (c) 2011, <NAME>
//  All rights reserved.
//
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions are met:
//
//  * Redistributions of source code must retain the above copyright
//   notice, this list of conditions and the following disclaimer.
//
//  * Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the
//   documentation and/or other materials provided with the distribution.
//
//  * Neither the name UsefulBits nor the names of its contributors may be used
//   to endorse or promote products derived from this software without specific
//   prior written permission.
//
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
//  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
//  DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
//  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
//  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
//  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
//  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
//  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
//  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#import <UIKit/UIKit.h>

typedef void (^ViewDecorator) (UIView *view, CGRect dirtyRect, CGContextRef context);

extern ViewDecorator TileImageNamedDecorator(NSString *name);
extern ViewDecorator TileImageDecorator(UIImage *image);

extern ViewDecorator BottomKeylineDecorator(UIColor *color);

extern ViewDecorator ImageNamedForOrintationDecorator(NSString *name);
extern ViewDecorator ImageForOrintationDecorator(UIImage *portrait, UIImage *landscape);

extern ViewDecorator CombineDecoratorsFromArray(NSArray *decorators);
extern ViewDecorator CombineDecorators(ViewDecorator first, ...) NS_REQUIRES_NIL_TERMINATION;


<|start_filename|>UsefulBits/Foundation/NSDictionary+Types.h<|end_filename|>
//
//  NSDictionary+Types.h
//  UsefulBits
//
//  Created by <NAME> on 11/11/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSDictionary (Types)

- (NSString *)stringForKey:(id)key;
- (NSString *)stringForKey:(id)key default:(NSString *)defaultValue;

- (NSNumber *)numberForKey:(id)key default:(NSNumber *)defaultValue;
- (NSNumber *)numberForKey:(id)key;

- (NSArray *)arrayForKey:(id)key default:(NSArray *)defaultValue;
- (NSArray *)arrayForKey:(id)key;

@end


<|start_filename|>UsefulBits/Foundation/Stack.h<|end_filename|>
//
//  Stack.h
//  UsefulBits
//
//  Created by <NAME> on 31/01/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Stack : NSObject

- (void)push:(id)object;
- (id)pop;
- (id)peek;

- (BOOL)isEmpty;

@end


<|start_filename|>UsefulBits/Foundation/NSNumber+Hex.h<|end_filename|>
//
//  NSNumber+Hex.h
//  UsefulBits
//
//  Created by <NAME> on 9/12/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSNumber (Hex)

+ (NSNumber *)integerWithHexString:(NSString *)hexString;

@end


<|start_filename|>UsefulBits/Foundation/UBFoundationFunctions.h<|end_filename|>
//
//  UBFoundationFunctions.h
//  UsefulBits
//
//  Created by <NAME> on 5/02/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

NSArray *indexPathsForRange(NSRange range);
