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)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
// Override point for customization after application launch. | |
if (![self deviceHasCamera]) { | |
// the storyboard name is the part before .storyboard | |
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" | |
bundle:nil]; | |
// set the rootviewController to the viewcontroller in the storyboard above. | |
self.window.rootViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"noCamera"]; | |
} |
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
- (CGPoint)getUserTouchFromSet:(NSSet *)touches | |
{ | |
UITouch *touch = [[touches allObjects] objectAtIndex:0]; | |
CGPoint touchPoint = [touch locationInNode: self]; | |
return touchPoint; | |
} | |
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
CGPoint userTouch = [self getUserTouchFromSet: touches]; |
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
from datetime import datetime | |
d = datetime.strptime("12:40 AM", "%I:%M %p") | |
print d.strftime("%H:%M") |
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
// | |
// CJCAnonymousFacesFilter.h | |
// CJC.FaceMaskingDemo | |
// | |
// Created by Chris Cavanagh on 11/9/13. | |
// Copyright (c) 2013 Chris Cavanagh. All rights reserved. | |
// | |
#import <CoreImage/CoreImage.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
- (AVCaptureDevice *) getCaptureDeviceWithPosition:(AVCaptureDevicePosition)position | |
{ | |
AVCaptureDevice *device; | |
// loop through all capture devices with video mediatype | |
for (AVCaptureDevice *d in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) { | |
check if the devices position is the desired one | |
if ([d position] == position) { | |
device = d; | |
} |
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 <stdint.h> | |
// GPIO pins used for connected gamepad | |
#define CLOCK 21 | |
#define LATCH 20 | |
#define DATA 19 | |
#define DEVICE_METHOD_JOYSTICK 0 | |
#define DEVICE_METHOD_KEYBOARD 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
#include <stdint.h> | |
// GPIO pins used for connected gamepad | |
#define CLOCK 21 | |
#define LATCH 20 | |
#define DATA 19 | |
enum { | |
NES_BUTTON_A, | |
NES_BUTTON_B, |
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 <stdint.h> | |
// GPIO pins used for connected gamepad | |
#define CLOCK 21 | |
#define LATCH 20 | |
#define DATA 19 | |
#define DEVICE_TYPE_NES 0 | |
#define DEVICE_TYPE_SNES 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
def addOne(x): | |
return x+1 | |
# prints 5 | |
print addOne(4) | |
# also prints 5 | |
print addOne(addOne(3)) |
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
if appIsRunning("Spotify") then | |
tell application "Spotify" to pause | |
end if | |
tell application "System Events" to start current screen saver | |
on appIsRunning(appName) | |
tell application "System Events" to (name of processes) contains appName | |
end appIsRunning |
NewerOlder