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
public struct Lense<T: AnyObject,V: Any> { | |
public let getter: () -> V | |
public let setter: (value: V) -> () | |
init(getter: () -> V, setter: (value: V) -> ()) { | |
self.getter = getter; | |
self.setter = setter; | |
} | |
} |
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
@implementation NSControl (SMTriggerAction) | |
- (void)triggerAction { | |
[self sendAction:self.action to:self.target]; | |
for (NSValueBinder *binder in [[self _bindingAdaptor] binders]) { | |
[binder performAction:self]; | |
} | |
} |
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 SMSplineSubdivisionIterate_Private(CGPoint p1, CGPoint p2, CGPoint p3, CGPoint p4, CGFloat u, CGFloat du, BOOL *stop, BOOL(^block)(CGPoint p1, CGPoint p2, CGPoint p3, CGPoint p4, CGFloat u, CGFloat du, BOOL *stop)) { | |
// Call block for the given spline | |
if (!block(p1, p2, p3, p4, u, du, stop)) { | |
// don't continue with the subdivisions | |
return; | |
} | |
if (*stop) { | |
// stop the whole iteration | |
return; | |
} |
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)mouseDown:(NSEvent *)downEvent { | |
CGFloat doubleClickTime = [NSEvent doubleClickInterval] ; | |
NSEventMask eventMask = NSLeftMouseDraggedMask | NSLeftMouseUpMask; | |
// Is this a singe, double or triple click? Or long click, or a drag? | |
NSEvent *nextEvent = [NSApp nextEventMatchingMask:eventMask untilDate:[NSDate dateWithTimeIntervalSinceNow:doubleClickTime] inMode:NSEventTrackingRunLoopMode dequeue:YES]; | |
if (nextEvent) { | |
// could be an up or a drag | |
if (nextEvent.type == NSLeftMouseUp) { | |
// got at least a single click, make sure it's not performing a double click | |
if ( (nextEvent = [NSApp nextEventMatchingMask:NSLeftMouseDownMask untilDate:[NSDate dateWithTimeIntervalSinceNow:doubleClickTime] inMode:NSEventTrackingRunLoopMode dequeue:YES]) ) { |
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
expr -- (void)printf("[%s %s]\n",(char *) object_getClassName(*(long*)($rdi)), (char *)($rsi)) |
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 "SMDocument.h" | |
@implementation SMDocument | |
- (id)init { | |
self = [super init]; | |
if (self) { | |
NSManagedObjectContext *context = self.managedObjectContext; | |
if (context.concurrencyType != NSMainQueueConcurrencyType) { | |
NSUndoManager *undoManager = context.undoManager; |
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
// | |
// main.m | |
// HypotTest | |
// | |
// Created by Stephan Michels on 08.01.12. | |
// Copyright (c) 2012 Stephan Michels Softwareentwicklung und Beratung. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
NewerOlder