Live data from Hacker News

Show HN: AspectRat.io – Aspect ratio calculator and device resolutions resource

aspectrat.io

1–10 of 34 posts

Re: Show HN: AspectRat.io – Aspect ratio calculator and device resolutions resource

#4

Not sure why make a whole website of this 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 }

Have an upvote.

The limit on ridiculous things people will somehow make into a "web service" knows no bounds.

Re: Show HN: AspectRat.io – Aspect ratio calculator and device resolutions resource

#5

What’s the use case for the CSS code? The `padding-top` value doesn’t account for the OS and browser’s chrome (status bar, URL bar, etc.), so the `.inner` element doesn’t fit into the viewport.

For responsive embeds I assume. Where the embedded ".inner" component scales it's height according to it's width.

Re: Show HN: AspectRat.io – Aspect ratio calculator and device resolutions resource

#6

Not sure why make a whole website of this 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 }

He/she/it hasn't heard of 1920x1200 :) All those devices are 16:9 i think?

Re: Show HN: AspectRat.io – Aspect ratio calculator and device resolutions resource

#7

Not sure why make a whole website of this 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 }

Because my non-programmer friend can use a website, but not write a program.

Re: Show HN: AspectRat.io – Aspect ratio calculator and device resolutions resource

#8
The site has a bit of Webkit-only CSS. Tip: don't use bleeding edge CSS like appearance, and if you do, at least test it in Chrome, Edge, and Firefox.

You can fix the broken CSS for Firefox by adding -moz-appearance in addition to -webkit-appearance.

https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appear...

Re: Show HN: AspectRat.io – Aspect ratio calculator and device resolutions resource

#9
post #8

The site has a bit of Webkit-only CSS. Tip: don't use bleeding edge CSS like appearance , and if you do, at least test it in Chrome, Edge, and Firefox. You can fix the broken CSS for Firefox by adding -moz-appearance in addition to -webkit-appearance . https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appear...

Whoops, just pushed up a fix. Just threw this together and didn't test it like I should have. Should be good now.

Re: Show HN: AspectRat.io – Aspect ratio calculator and device resolutions resource

#10

Not sure why make a whole website of this 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 }

Yeah, this is really more of a reference and a tool when you’re comparing sizes and confirming they are the same aspect ratio without having to use code. There’s also an NPM module that will do the code part if you need to go that route.
Post reply on HN