Skip to content

Instantly share code, notes, and snippets.

View sstigler's full-sized avatar

Sam Stigler sstigler

  • Thousand Oaks, CA, USA
View GitHub Profile
@vincent178
vincent178 / NSTask-Output.m
Created September 24, 2013 07:57
Get NSTask Standard Output
NSTask * list = [[NSTask alloc] init];
[list setLaunchPath:@"/bin/ls"];
[list setCurrentDirectoryPath:@"/"];
NSPipe * out = [NSPipe pipe];
[list setStandardOutput:out];
[list launch];
[list waitUntilExit];
[list release];
@mattstevens
mattstevens / gist:4400775
Last active March 9, 2022 12:53
Resizing an NSImage on retina Macs for output as a 1x image
NSImage *computerImage = [NSImage imageNamed:NSImageNameComputer];
NSInteger size = 256;
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:size
pixelsHigh:size
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES