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
BOOL dragUp = [pan velocityInView:<#UIView#>].y < 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
// | |
// APAppDelegate.m | |
// TestMouse | |
// | |
// Created by alberto pasca on 04/09/14. | |
// Copyright (c) 2014 albertopasca.it. All rights reserved. | |
// | |
#import "APAppDelegate.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
// listen for keystrokes | |
[NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) | |
{ | |
NSLog(@"%lui -- %@", (unsigned long)[event modifierFlags], event.characters ); | |
// | |
// if flag and char do something, like bring to front the application | |
// 256 is ESC, in my case. | |
// |
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
lipo -create libPhone.a libSimulator.a -output libUniversal.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
<?php | |
class MyClass | |
{ | |
private static $instance = null; | |
private function __construct() { } | |
public static function getInstance() | |
{ | |
if(self::$instance == null) | |
{ |
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
// | |
// 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
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
#!/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
- (NSString *)contentTypeForImageData:(NSData *)data { | |
uint8_t c; | |
[data getBytes:&c length:1]; | |
switch (c) { | |
case 0xFF: | |
return @"jpeg"; | |
case 0x89: | |
return @"png"; | |
case 0x47: |