by toqy · 4y ago · 0 comments
console.table([...document.querySelectorAll('.fatitem table .athing')].map(el => [el.textContent.trim(), el.nextSibling.textContent.trim()]).sort(([,a], [,b]) => parseInt(b) - parseInt(a))) 'US: California' '79 points'
'Canada' '48 points'
'US: Washington' '39 points'
'US: New York' '36 points'
'Germany' '35 points'
'United Kingdom' '34 points'
'US: Massachusetts' '19 points'
'Netherlands' '18 points'
'US: Colorado' '17 points'
'Sweden' '16 points'
Colorado #9? Really? 'US: California', '10.87%'
'Canada', '5.79%'
'United Kingdom', '4.51%'
'US: Washington', '4.45%'
'Germany', '4.45%'
'US: New York', '4.32%'
'US: Colorado', '2.10%'
'US: Texas', '1.97%'
'US: Massachusetts', '1.84%'
'France', '1.78%'
The US in total makes up 49% of responses so far (even though it is nearly 10pm in most of Europe)Edit: quick and dirty one-liner to get the full table with relative values:
data = [...document.querySelectorAll('.fatitem table .athing')].map(el => [el.textContent.trim(), el.nextSibling.textContent.trim()]).sort(([,a], [,b]) => parseInt(b) - parseInt(a)); total = data.map(a => parseInt(a[1])-1).reduce((a,b) => a+b, 0); console.table(data.map(a => [a[0], ((parseInt(a[1])-1)/total*100).toFixed(2) + "%"])); us = data.filter(a => a[0].startsWith("US:")).map(a => parseInt(a[1])-1).reduce((a,b) => a+b, 0); `US makes up ${(us/total*100).toFixed(2)}% of ${total} responses`
Edit2: made one-liner even dirtier to account for counts starting at 1Anyways, here's the current result in a pastebin: https://pastebin.com/fR89qMKk
Also the UK and Germany being about the same is interesting. Germany does have a slightly larger population, but of course the UK is natively English speaking.
Also, given the new(ish) move to remote work that many firms nationally have begun to embrace there is also a strong showing here of people that work in Colorado, but for firms located elsewhere. This is my personal current situation, and I work with a guy who is moving here from the midwest in a couple months to work 100% remote. It's more and more common.
Only two people in my network of people I know lost power in Texas, one of which was a coworker's neighbor because said coworker's tree dropped a branch on the neighbor's overhead power delivery line.
Tried to access some dashboards that are supposed to show some data, but not sure if I can't access it because I'm not in the US/Texas or if it's down as well (because they don't have power?)
- https://www.ercot.com/gridmktinfo/dashboards
- https://www.ercot.com/gridmktinfo/dashboards/gridconditions
- https://www.ercot.com/gridinfo
Says "This request was blocked by the security rules" so I'm assuming it's the former.
Denver's also a big telecommunications and defense hub. Both industries employ armies of developers
Large US states are more populous than most countries, and the US tech industry is orders of magnitude larger than most countries'.
If US weren't broken out, it would be a huge outlier at the top and wouldn't be nearly as interesting.
I don't know of any other country that would make the chart that much more interesting by being broken up.
console.table([...document.querySelectorAll('.fatitem table .athing')].map(el => ({place: el.textContent.trim(), score: parseInt(el.nextSibling.textContent)})).sort((a, b) => b.score - a.score)) console.table([...document.querySelectorAll('.fatitem table .athing')].map(el => ({place: el.textContent.trim(), score: parseInt(el.nextSibling.textContent)})).sort((a, b) => b.score - a.score || a.place.localeCompare(b.place))) javascript:document.write('<table>' + [...document.querySelectorAll('.fatitem table .athing')].map(el => ({place: el.textContent.trim(), score: parseInt(el.nextSibling.textContent)})).sort((a, b) => b.score - a.score || a.place.localeCompare(b.place)).map(e => `<tr><td>${e.place}<td align=right>${e.score}`).join('') + '</table>')It works on Chrome for Android.
console.table([...document.querySelectorAll('.fatitem table .athing')].map(el => [el.textContent.replace(/:.*/,'').trim(), parseInt(el.nextSibling.textContent.trim())]).reduce((d, [k,v]) => {d[k]=v + (d[k] || 0); return d}, {}))
I can't figure out how to sort that, though...Are you accepting PRs? If so, align=right. Thanks!
To see the sorted results: https://gabrielsroka.github.io/hnpoll.html?id=30210378
Source: https://github.com/gabrielsroka/gabrielsroka.github.io/blob/...
Makes sense, otherwise entries would contain itself.
Thank you!
Source: https://github.com/gabrielsroka/gabrielsroka.github.io/blob/...
Noob question: is there a similar way to dump it to JSON, instead of a table?
JSON.stringify([...document.querySelectorAll('.fatitem table .athing')].map(el => [el.textContent.trim(), el.nextSibling.textContent.trim()]).sort(([,a], [,b]) => parseInt(b) - parseInt(a)))
JSON.stringify([...document.querySelectorAll('.fatitem table .athing')].map(el => [el.textContent.trim(), el.nextSibling.textContent.trim()]).sort(([,a], [,b]) => parseInt(b) - parseInt(a)))