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
// | |
// APLogger.h | |
// Copyright (c) 2015 Alberto Pasca. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface APLogger : NSObject | |
void APLog ( NSString* format, ... ); |
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
NSDate *_start; | |
- (void) start | |
{ | |
_start = [NSDate date]; | |
} | |
- (void) stopMethod:(NSString*)pMethod line:(int)pLine | |
{ |
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
// | |
// ViewController.m | |
// DynamicMotion | |
// | |
// Created by Alberto Pasca on 20/05/15. | |
// Copyright (c) 2015 Alberto Pasca. All rights reserved. | |
// | |
#import "ViewController.h" | |
#import <CoreMotion/CoreMotion.h> |
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/sh | |
xcodebuild -scheme AppName clean archive -archivePath /Users/pasky/Desktop/AppName | |
xcodebuild -exportArchive -exportFormat ipa -archivePath "/Users/pasky/Desktop/AppName.xcarchive" -exportPath "/Users/pasky/Desktop/AppName.ipa" -exportProvisioningProfile "XC Ad Hoc: com.AppName.iphone.app" | |
rm -rf "/Users/pasky/Desktop/AppName.xcarchive" | |
mv "/Users/pasky/Desktop/AppName.ipa" "/Volumes/DATA/Dropbox/Public/AppName.ipa" | |
echo "done." |
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
// | |
// CoreTextLabel.h | |
// Frost | |
// | |
// Created by David Kasper on 10/1/12. | |
// | |
#import <UIKit/UIKit.h> | |
#import <CoreText/CoreText.h> |
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 APViewController () | |
{ | |
NSMutableArray *_Labels; | |
} | |
- ( void ) forEachLabel: ( void (^)( UILabel * label ) ) block; | |
@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
@interface APPassThroughUIView : UIView | |
@end | |
@implementation APPassThroughUIView | |
- (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event | |
{ | |
for (UIView *v in self.subviews) | |
{ |
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
- (NSDictionary*) loadJson | |
{ | |
NSString *fPath = [[NSBundle mainBundle] pathForResource:@"jtest" ofType:@"json"]; | |
NSData *data = [NSData dataWithContentsOfFile:fPath]; | |
return | |
[ NSJSONSerialization JSONObjectWithData: data | |
options: NSJSONReadingMutableContainers | |
error: 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
int N(int n, int k) { | |
if (n == 0) return k == 0 ? 1 : 0; | |
return (N(n-1, k-1) + N(n-1, k)*(n-1-k)) + N(n-1, k+1)*(k+1) % 2810; | |
} | |
int num[] = {N(3,6)+105,N(8,5)-2,102,N(8,5)-1,64,97+N(3,6), | |
108,98,101,N(8,5)+2,116,N(8,5)-1,N(8,5), | |
97,115,99,97,(N(8,6)*2)-10,105,N(8,5)+4}; | |
for ( auto n : num ) | |
printf ( "%c", n ); |
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 *)contentTypeForImageData:(NSData *)data { | |
uint8_t c; | |
[data getBytes:&c length:1]; | |
switch (c) { | |
case 0xFF: | |
return @"jpeg"; | |
case 0x89: | |
return @"png"; | |
case 0x47: |