This file contains hidden or 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
| // | |
| // HTTPLoader.h | |
| // | |
| #import <Foundation/Foundation.h> | |
| typedef void(^ HTTPLoaderCompletionBlock)(NSData *data, NSError *erorr); | |
| @interface HTTPLoader : NSObject |
This file contains hidden or 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
| - (UIViewController *)viewControllerForView:(UIView *)view { | |
| UIResponder *nextResponder = [view nextResponder]; | |
| if (nextResponder) { | |
| if ([nextResponder isKindOfClass:[UIViewController class]]) { | |
| return (UIViewController *)nextResponder; | |
| } else { | |
| return [self viewControllerForView:view.superview]; | |
| } | |
| } | |
| return nil; |
This file contains hidden or 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
| - (void)didRotate:(NSNotification *)notification { | |
| UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; | |
| UIView *portraitClockView = portraitClockViewController.view; | |
| UIView *landscapeClockView = landscapeClockViewController.view; | |
| if (orientation == UIDeviceOrientationLandscapeLeft) { | |
| CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI / 2.0f); | |
| // landscapeClockView.center = CGPointMake(240.0f, 160.0f); | |
| landscapeClockView.transform = transform; |
This file contains hidden or 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 "SDTableViewCell.h" | |
| @implementation SDTableViewCell | |
| @synthesize iconView; | |
| @synthesize indicatorView; | |
| @synthesize titleLabel; | |
| - (void)dealloc { | |
| [iconView removeObserver:self forKeyPath:@"image"]; |
This file contains hidden or 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
| // バックグラウンドでGoogle Calendarからイベントを受信して保存するクラス | |
| - (void)main { | |
| if (!self.isCancelled) { | |
| NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
| if (!self.isCancelled) { | |
| NSManagedObjectContext *managedObjectContext = [self managedObjectContext]; | |
| [managedObjectContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy]; | |
| SPEventStore *eventStore = [SPEventStore defaultEventStore]; | |
| events = [[eventStore searchEventsWithPredicate:predicate] retain]; | |
| } |
This file contains hidden or 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
| #!/bin/bash | |
| export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate | |
| codesign -f -s "iPhone Developer" "$1" |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <dlfcn.h> | |
| #include "ffi.h" | |
| int main(int argc, char *argv[]) | |
| { | |
| void *dlh = dlopen(argv[0], RTLD_LAZY); | |
| void *fp = dlsym(dlh, "puts"); | |
| ffi_cif cif; |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <dlfcn.h> | |
| #include <avcall.h> | |
| int main(int argc, char *argv[]) { | |
| int ret; | |
| av_alist alist; | |
| void *dlh; | |
| void *fp; | |
This file contains hidden or 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 DATA(str) [(NSString*)(str) dataUsingEncoding:NSUTF8StringEncoding] | |
| - (NSData *)generateFormData:(NSDictionary *)dictionary boundary:(NSString *)boundary { | |
| NSMutableData *data = [[NSMutableData alloc] init]; | |
| id key; | |
| NSEnumerator *enumerator = [dictionary keyEnumerator]; | |
| while (key = [enumerator nextObject]) { | |
| id value = [dictionary valueForKey:key]; | |
| [data appendData:DATA(([NSString stringWithFormat:@"--%@\r\n", boundary]))]; |
This file contains hidden or 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 UIImage(Utilities) | |
| - (CGRect)convertCropRect:(CGRect)cropRect { | |
| UIImage *originalImage = self; | |
| CGSize size = originalImage.size; | |
| CGFloat x = cropRect.origin.x; | |
| CGFloat y = cropRect.origin.y; | |
| CGFloat width = cropRect.size.width; | |
| CGFloat height = cropRect.size.height; |