by sd8dgf8ds8g8dsg · 9y ago · 0 comments
w := 1900
h := 1200
divisor := gcd(w, h)
aspect := fmt.Sprintf("%d:%d", w/divisor, h/divisor)
func gcd(x, y int64) int64 {
for y != 0 {
x, y = y, x%y
}
return x
}edit: They're already happy to have it in their back pocket.
https://www.apple.com/macbook-pro/specs/
Select 15" and scroll to Display section.
The limit on ridiculous things people will somehow make into a "web service" knows no bounds.
Also, I’ll be extending the device/resolutions listing, so hopefully it can be a handy reference for designers/developers.
> just a reference tool, along with an NPM module you can use.
Why does ~6 lines of basic logic need an NPM module?
Also, it has a command line tool that you can use to get the aspect ratio from width/height. So, not just the code.