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
--- | |
title: "BCU Covid-19 statistics" | |
output: | |
pdf_document: default | |
html_document: default | |
--- | |
## Install dependencies | |
```{r} |
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
custom_rules: | |
developer_warning: | |
included: ".*.swift" | |
name: "Developer Warning" | |
regex: "//\h*?(?i)warning" # matches '// WARNING' (case insensitive) | |
match_kinds: comment | |
message: "Fix before merging" | |
severity: warning |
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
### Keybase proof | |
I hereby claim: | |
* I am njdehoog on github. | |
* I am nielsdehoog (https://keybase.io/nielsdehoog) on keybase. | |
* I have a public key ASCcwc48V8dVR844Z9Mgwyx4mn2j7clhigAIYKPFWj-vLgo | |
To claim this, I am signing this object: |
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
class Foo: NSObject { | |
private let bar = Bar() | |
private var kvoContext = 0 | |
override init() { | |
super.init() | |
bar.addObserver(self, forKeyPath: "string", options: .New, context: &kvoContext) | |
bar.string = "world" | |
} | |
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
class Person { | |
var name = Observable("John") | |
} | |
let person = Person() | |
person.name.subscribe() { oldValue, newValue in | |
println("name changed: \(oldValue) to \(newValue)") | |
} | |
person.name.value = "Jane" |
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
struct Observable<T> { | |
typealias ValueType = T | |
typealias SubscriptionType = Subscription<T> | |
var value: ValueType { | |
didSet { | |
for subscription in subscriptions { | |
let event = ValueChangeEvent(oldValue, value) | |
subscription.notify(event) | |
} |
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
class KeyValueObserver: NSObject { | |
typealias KeyValueObservingCallback = (change: [NSObject : AnyObject]) -> Void | |
private let object: NSObject | |
private let keyPath: String | |
private let callback: KeyValueObservingCallback | |
private var kvoContext = 0 | |
init(object: NSObject, keyPath: String, options: NSKeyValueObservingOptions, callback: KeyValueObservingCallback) { | |
self.object = object |
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
MKMapRect zoomRect = MKMapRectNull; | |
for (id <MKAnnotation> annotation in mapView.annotations) { | |
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate); | |
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0); | |
if (MKMapRectIsNull(zoomRect)) { | |
zoomRect = pointRect; | |
} else { | |
zoomRect = MKMapRectUnion(zoomRect, pointRect); | |
} | |
} |
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
// | |
// NSObject+BlockObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// [email protected] | |
// Public domain because I love you. Let me know how you use it. | |
// | |
#import <Cocoa/Cocoa.h> |