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
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"]; | |
animation.duration = 5.0f; | |
CATransform3D transform = CATransform3DIdentity; | |
transform = CATransform3DRotate(transform, 180.0f * M_PI / 180.0f, 0.0f, 1.0f, 0.0f); | |
animation.toValue = [NSValue valueWithCATransform3D:transform]; | |
[contentView.layer addAnimation:animation forKey:nil]; |
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 os | |
import csv | |
from subprocess import Popen, PIPE | |
from Foundation import NSMutableDictionary | |
build_number = os.popen4("git rev-parse --short HEAD")[1].read() | |
info_plist = os.environ['BUILT_PRODUCTS_DIR'] + "/" + os.environ['WRAPPER_NAME'] + "/Info.plist" | |
# Open the plist and write the short commit hash as the bundle version | |
plist = NSMutableDictionary.dictionaryWithContentsOfFile_(info_plist) |
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
static inline NSString *convertSelName(const char *hax3d) { | |
int length = strlen(hax3d); | |
char name[length + 1]; | |
for (int i = 0; i < length; ++i) { | |
char c = hax3d[i]; | |
if (c == ':' || c == '_') { | |
name[i] = c; | |
} else if (c >= 'a' && c <= 'z') { | |
name[i] = ((c - 'a' + 13) % 26) + 'a'; |
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 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; |
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 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 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 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 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 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 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"]; |