Skip to content

Instantly share code, notes, and snippets.

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)
// 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 = ^{
#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
- (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);
}];
}
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];
@beelsebob
beelsebob / NSAlert+Blocks
Created October 27, 2011 13:51 — forked from PsychoH13/PSYBlockTimer.h
Fire an NSTimer using a block as execution code.
//
// NSAlertWithBlocks.h
//
// Created by Thomas Davie on 26/12/2009.
// Copyright 2009 Thomas Davie. All rights reserved.
//
#import <Cocoa/Cocoa.h>
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;
}