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 CoreLocation | |
| # print dir(CoreLocation) | |
| class ShowLocation(object): | |
| """docstring for ShowLocation""" | |
| def locationManager_didUpdateToLocation_fromLocation_(self, manager, newLocation, oldLocation): | |
| """docstring for didUpdateToLocation:fromLocation:""" | |
| print "moo" #newLocation, oldLocation | |
| def timerFire_(self, timer) |
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
| // For ARC | |
| __block __weak typeof(pitem) bpitem = pitem; | |
| pitem.urlBlock = ^{ | |
| bpitem.isExpanded = !bpitem.isExpanded; | |
| [self.controller expandCellWithPost:bpitem.post type:bpitem.expanded]; | |
| }; | |
| // For Non-ARC | |
| __block typeof(pitem) bpitem = pitem; | |
| pitem.urlBlock = ^{ |
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 <Foundation/Foundation.h> | |
| @interface Coordinate : NSObject | |
| @property (nonatomic, assign) int x; | |
| @property (nonatomic, assign) int y; | |
| - (Coordinate *)initWithX:(int)_x y:(int)_y; | |
| @end |
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)printDummyStuff | |
| { | |
| TestClass1 *tc1 = [[TestClass1 alloc] init]; | |
| [tc1 performSimulationWithFitnessFunction:^ int (int a) | |
| { | |
| int b = [self stuff:a]; | |
| int c = [self magic]; | |
| return b * (c + b * c); | |
| }]; | |
| } |
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
| NSString *currentDir = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent]; | |
| NSTask *task = [[NSTask alloc] init]; | |
| [task setLaunchPath: @"/usr/bin/java"]; | |
| [task setCurrentDirectoryPath:currentDir]; | |
| [task setArguments:[NSArray arrayWithObjects:[NSString stringWithFormat:@"-Xmx%dM", [RamTextField intValue]], [NSString stringWithFormat:@"-Xms%dM", [RamTextField intValue]], @"-jar", [NSString stringWithFormat:@"%@/minecraft_server.jar", currentDir], nil]]; | |
| NSPipe *pipe = [NSPipe pipe]; | |
| [task setStandardError: pipe];//Return Error only | |
| [task setStandardInput:[NSPipe pipe]]; | |
| NSFileHandle *file = [pipe fileHandleForReading]; | |
| [task launch]; |
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
| // | |
| // NSAlertWithBlocks.h | |
| // | |
| // Created by Thomas Davie on 26/12/2009. | |
| // Copyright 2009 Thomas Davie. All rights reserved. | |
| // | |
| #import <Cocoa/Cocoa.h> | |
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
| uint8 *fourchan = (uint8*) malloc(sizeof(uint8) * width * height * 4); | |
| short cur; | |
| short *subscript = (short*) imgData; | |
| for (int i = 0; i < width * height; i++) { | |
| cur = (subscript[i] + 1000) / (int) pow(2., sizeof(short)/2.); | |
| fourchan[i*4] = (uint8) cur; | |
| } |
NewerOlder