This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
typedef id (^fanc_t)(id); | |
typedef void (^noReturn_t)(id); | |
@interface NSArray (Fanctional) | |
+ (NSArray *)from:(NSInteger)from to:(NSInteger)to; | |
- (NSArray *)map:(fanc_t)fanc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *)randStringWithMaxLenght:(NSInteger)max { | |
NSInteger length = [self randBetween:1 max:max]; | |
unichar letter[length]; | |
for (int i = 0; i < length; i++) { | |
letter[i] = [self randBetween:65 max:90]; | |
} | |
return [[NSString alloc] initWithCharacters:letter length:length]; | |
} | |
- (NSInteger)randBetween:(NSInteger)min max:(NSInteger)max { | |
return (random() % (max - min + 1)) + min; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define tuple(_1, _2) [Tuple tupleWithFirst:_1 second:_2]; | |
@interface Tuple : NSObject | |
@property (readonly, nonatomic) id _1; | |
@property (readonly, nonatomic) id _2; | |
+ (id)tupleWithFirst:(id)_1 second:(id)_2; | |
- (id)initWithFirst:(id)_1 second:(id)_2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface Tuple : NSObject | |
@property (readonly, nonatomic) id _1; | |
@property (readonly, nonatomic) id _2; | |
+ (id)tupleWithFirst:(id)_1 second:(id)_2; | |
- (id)initWithFirst:(id)_1 second:(id)_2; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)touchMove:(id)sender { | |
__weak typeof (self) this = self; | |
[self performSegueWithIdentifier:kSeguePicture sender:^(id controller) { | |
[controller setViewObject:this.viewObject]; | |
}]; | |
} | |
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(void (^)(id))sender { | |
if (sender) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation HogeViewController { | |
__weak IBOutlet UIView *piyo; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pod 'NSDate-Escort' | |
// pod 'AZDateBuilder' | |
#import "NSDate+Escort.h" | |
#import "NSDate+AZDateBuilder.h" | |
NSDate *date = [[[NSDate date] dateByAddingDays:1] AZ_dateByUnit: @{ | |
AZ_DateUnit.hour : @9, | |
AZ_DateUnit.minute : @0, | |
AZ_DateUnit.second : @0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (instancetype)sharedManager { | |
static id manager_ = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
manager_ = [[self alloc] init]; | |
}); | |
return manager_; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
class Bunch | |
def initialize(bunch1, bunch2 = nil) | |
(bunch2 != nil) ? mergeBunch(bunch1, bunch2) : initValue(bunch1) | |
end | |
def initValue(value) | |
@bunch1 = nil | |
@bunch2 = nil | |
@value = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation HideTabBar | |
+ (void)tabBarHidden:(BOOL)hide tabBar:(UITabBarController *)tabBarController { | |
CGFloat viewHeight = [self viewHeight:hide]; | |
for (UIView *view in tabBarController.view.subviews) { | |
CGRect _rect = view.frame; | |
if ([view isKindOfClass:[UITabBar class]]) { | |
_rect.origin.y = viewHeight; | |
} else { |
OlderNewer