layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories:
- Testing
- iOS
- Patterns
- Xcode
# updates an environment variable of a running process (needs sudo) | |
# example: sudo export_pid <variable=value> <pid> | |
export_process(){ | |
script=/tmp/.gdb.$2 | |
echo -e "attach $2\ncall putenv (\"$1\")\ndetach\n" > $script | |
gdb -q -batch -x $script &>/dev/null | |
rm $script | |
} |
let bitmapBuffer = UnsafePointer<UInt8>.alloc(Int(height * width * 4)) | |
let pixelNumber = (x * 4) + (y * width * 4) | |
bitmapBuffer[pixelNumber + 3] = 255 // Alpha | |
bitmapBuffer[pixelNumber + 2] = redValue | |
bitmapBuffer[pixelNumber + 1] = greenValue | |
bitmapBuffer[pixelNumber + 0] = blueValue |
layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories:
@implementation AppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
NSNotificationCenter *nc = [[NSWorkspace sharedWorkspace] notificationCenter]; | |
[nc addObserver:self | |
selector:@selector(spaceChanged:) | |
name:NSWorkspaceActiveSpaceDidChangeNotification | |
object:[NSWorkspace sharedWorkspace]]; |
-- AppleScript -- | |
-- This example is meant as a simple starting point to show how to get the information in the simplest available way. | |
-- Keep in mind that when asking for a `return` after another, only the first one will be output. | |
-- This method is as good as its JXA counterpart. | |
-- Webkit variants include "Safari", "Webkit", "Orion". | |
-- Specific editions are valid, including "Safari Technology Preview". | |
-- "Safari" Example: | |
tell application "Safari" to return name of front document |