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
| func genericDecode<T>(data: Data) -> T { | |
| let pointer = UnsafeMutablePointer<T>.allocate(capacity: MemoryLayout<T.Type>.size) | |
| data.copyBytes(to: pointer as! UnsafeMutablePointer<UInt8>, count: MemoryLayout<T.Type>.size) | |
| return pointer.move() | |
| } | |
| func genericEncode<T>(value: T) -> Data { | |
| var value = value |
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
| func directMetersFromCoordinate(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> Float { | |
| let DEG_TO_RAD = 0.017453292519943295769236907684886 | |
| let EARTH_RADIUS_IN_METERS = 6372797.560856 | |
| let latutideArc = (from.latitude - to.latitude) * DEG_TO_RAD | |
| let longitudeArc = (from.longitude - to.longitude) * DEG_TO_RAD | |
| var latitudeH = sin(latutideArc * 0.5) | |
| latitudeH *= latitudeH |
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
| defaults write com.apple.dt.xcodebuild PBXNumberOfParallelBuildSubtasks 4 | |
| defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4 |
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
| class PopAnimator:: NSObject, UIViewControllerAnimatedTransitioning { | |
| let duration = 1.0 | |
| var originFrame = CGRect.zero | |
| var presenting = true | |
| func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { | |
| return duration | |
| } | |
| func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { |
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
| MyView.superview?.constraints.forEach { constraint in | |
| // print("-> \(constraint.description)\n") | |
| if constraint.firstItem == MyView && | |
| constraint.firstAttribute == .centerX { | |
| print("-> \(constraint.description)\n") | |
| constraint.constant == myBool ? -100.0 : 0.0 | |
| return | |
| } | |
| if constraint.identifier == "my identifier set in Main Storyboard" { | |
| constraint.isActive = false |
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
| Suppose I conduct a study and publish my findings. Which of the following is an example of a replication of my study? | |
| - An investigator at another institution conducts a study addressing the same question, collects her own data, analyzes it separately from me, and publishes her own findings. | |
| Which of the following is a requirement for a published data analysis to be reproducible? | |
| - The full computer code for doing the data analysis is made publicly available. | |
| Which of the following is an example of a reproducible study? | |
| - The study's analytic data and computer code for the data analysis are publicly available. When the code is run on the analytic data, the findings are identical to the published results. | |
| Which of the following is a reason that a study might NOT be fully replicated? |
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 UIKit | |
| private var pTouchAreaEdgeInsets: UIEdgeInsets = .zero | |
| extension UIControl { | |
| var touchAreaEdgeInsets: UIEdgeInsets { | |
| get { | |
| if let value = objc_getAssociatedObject(self, &pTouchAreaEdgeInsets) as? NSValue { | |
| var edgeInsets: UIEdgeInsets = .zero |
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
| xcodebuild -workspace Grocerest.xcworkspace -scheme Grocerest clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" | grep [1-9].[0-9]ms | sort -nr > culprits.txt |
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
| rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/* |