This file contains 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
# format: | |
# -------------- | |
# date (mm/dd/yy) | |
# assignment | |
# assignment | |
# ... | |
# | |
# date | |
# assignment | |
# ... |
This file contains 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
// NSManagedObjectContext+DebugSwizzling.h | |
#import <CoreData/CoreData.h> | |
#if DEBUG | |
/** | |
* Toggles debugging of Core Data managed object contexts. | |
* | |
* When enabled, will fire NSLogs in the following cases: |
This file contains 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
/** | |
An Observable emits values to its subscribed observers. | |
A minimal implementation based upon the reactivex specification: | |
http://reactivex.io/documentation/observable.html | |
*/ | |
public class Observable<Value> { | |
/** Add a new observer. The provided instance will receive all values provided to onNext. */ | |
public func subscribe(_ observer: @escaping (Value) -> Void) -> Observable<Value> { | |
observers.append(observer) |
This file contains 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
const char* cstr = [string UTF8String]; | |
void* anon = mmap(0, sizeof(char) * (string.length + 1), PROT_WRITE|PROT_READ, MAP_ANON|MAP_PRIVATE, 0, 0); | |
if (anon == MAP_FAILED) { | |
NSLog(@"Failed to map memory."); | |
return; | |
} | |
strcpy(anon, cstr); | |
// How do I get a file descriptor for use here? |
This file contains 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
func start(with context: TransitionContext) { | |
guard let contextView = backDelegate.backContextView(for: self, | |
with: context.foreViewController) else { | |
return | |
} | |
guard let foreImageView = foreDelegate.foreContextView(for: self) else { | |
return | |
} |
This file contains 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
/* | |
Copyright 2017-present The Material Motion Authors. All Rights Reserved. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains 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 final class DirectlyManipulable { | |
public func add(to view: UIView, withRuntime runtime: MotionRuntime, constraints: NoConstraints) | |
public final class Constraints { | |
public var draggable: ConstraintApplicator<T>? | |
public var rotatable: ConstraintApplicator<T>? | |
public var scalable: ConstraintApplicator<T>? | |
} | |
} |
This file contains 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
CGVector NIVectorMakeWithPoints(CGPoint fromPoint, CGPoint toPoint); | |
CGVector NIVectorMakeWithPoint(CGPoint point); | |
CGPoint NIPointMakeWithVector(CGVector vector); | |
NSString* NIStringFromVector(CGVector vector); | |
CGFloat NIVectorLength(CGVector vector); | |
CGFloat NIRadiansFromReferenceVectorToVector(CGVector vector); | |
CGFloat NIVectorDotProduct(CGVector vector1, CGVector vector2); | |
extern const CGVector NIReferenceVector; |
This file contains 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 func openValve<O: MotionObservableConvertible>(whenAllTrue observables: [O]) -> MotionObservable<T> where O.T == Bool { | |
return MotionObservable<T> { observer in | |
var upstreamSubscription: Subscription? | |
var connectUpstream = { | |
upstreamSubscription = self.asStream().subscribe(next: observer.next, | |
state: observer.state, | |
coreAnimation: observer.coreAnimation) | |
} |
This file contains 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
let square2Reactive = runtime.get(square2.layer) | |
let pan = runtime.get(UIPanGestureRecognizer()) | |
let rawPosition = createProperty(withInitialValue: square2.layer.position) | |
runtime.add(pan.translated(from: rawPosition, in: view), to: rawPosition) | |
runtime.add(rawPosition.y().rubberBanded(below: 50, above: 400, length: 100), to: square2Reactive.positionY) |