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
extension Array where Element : Hashable { | |
func modalValue() -> Self.Element? { | |
// populate a dictionary of element vs count | |
var dict: [Self.Element : Int] = [:] | |
self.forEach { v in | |
if let count = dict[v] { | |
dict[v] = count + 1 | |
} else { |
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 p1 = { x: 59197011, y: 42146958, z: 42913136384, sx: 24, sy: 470 }; | |
const p2 = { x: 59197011, y: 21399618, z: 42913136384, sx: 254, sy: 664 }; | |
const p3 = { x: 6735114, y: 33773393, z: 4287356928 , sx: 808, sy: 65 }; | |
const p4 = { x: 26245172, y: 42146958, z: 4293136384, sx: 495, sy: 212 }; | |
function project({x, y, z}) { | |
// use p4 as the origin | |
x -= p4.x; | |
y -= p4.y; |
OlderNewer