1,791 karma · joined Oct 27, 2012 (14y ago) · 297 submissions
comment 8y ago · link · parent
Anyway since we're on HN you should know that Chrome has a "offline" button in its network tab in its developer tool, used for testing offline features, so you can take a single tab offline, instead of disconnecting everything.
comment 8y ago · link · parent
comment 8y ago · link · parent
You can't beat the laws of thermodynamics. When the wet bulb temperature reaches the human body's natural 37 degrees Celsius, it'll be impossible for the body to expel heat via sweating (evaporative cooling). At that point no amount of adaptation will help, and humans need technology to stay alive.
comment 8y ago · link · parent
Webpack pulls dependencies into one file and deduplicates them. This is obviously even more complex since now you have dependency resolution logic as well as dealing with the various module systems JavaScript has invented.
comment 8y ago · link · parent
This was generated by one line of code, simply applying the hoist-non-react-statics library as recommended by the official React docs https://reactjs.org/docs/higher-order-components.html#static...
JavaScript in many cases can be too dynamic to be properly typed. I'd rather have it than not - it has saved my ass a good number of times - but let's not pretend TS/Flow is totally wonderful.
comment 8y ago · link · parent
* "Christmas" in "Merry Christmas, and have a nice day"
* "at 100" in "It could be that you're not viewing the image at 100% zoom"
* Four digit module codes from my university that looks like four digit military time
and so on, ignoring context or even prefix/suffix text which makes it clear the text is not a date. It would be funny if these don't keep getting in the way when random words in conversation gets turned into links.
comment 8y ago · link · parent
comment 8y ago · link · parent
In most cases this is harmless - play a song, and YouTube will automatically create a playlist of songs in the same genre. Watch a cooking video, and it'll give you a dozen other recipes by the same chef.
Unfortunately this doesn't work for political videos, as you've noticed. But there is absolutely no incentive for YouTube to insert videos from opposing viewpoints into the recommendations. YouTube is just giving people what they want.
comment 8y ago · link · parent
This is what the site looks like with both sticky bars open on my 900px high screen. This is atrocious. https://i.imgur.com/o5hcENG.png
comment 9y ago · link · parent
comment 9y ago · link · parent
addEventListener is possibly the worst organically grown API I've seen in a long time. If anything, its sordid history should be a lesson to the Chrome dev team that fucking around with proprietary extensions (which this most definitely is) just leads to future technical debt and pain for everyone. Why do they never learn?
comment 9y ago · link · parent
comment 9y ago · link · parent
As an example: To this day I have no idea what media formats are supported by AVAudioPlayer on iOS[2]. The documentation's links (Cmd+F "iOS Hardware and Software Audio Codecs") have been broken for so long that not even the Wayback Machine has a copy. And Googling for the same information only gives me Stack Overflow answers that references the same broken link. I suspect at this point not even Apple knows what formats their own audio framework is capable of playing.
[1]: https://yuiblog.com/blog/2006/10/20/video-crockford-domtheor...
[2]: https://developer.apple.com/documentation/avfoundation/avaud...
comment 9y ago · link · parent
Opinionated: React is a library written for a language that is not JavaScript (the first prototype was written in OCaml). It demands immutability, which JS has no native support for. it wants you to use FP, but JS natively has little support for FP both in its standard library and syntax. FP only looks good in JS if you've never used a real FP language.
DSL: JSX is a DSL - I can't remember the last time I've seen someone use && as a poor man's if statement, or ternary statements dozens of lines long until I started writing JSX. JSX is neither idiomatic JavaScript nor HTML.
Fast: Performance benchmarks (which admitted are flawed as they can't capture real-world usage) show that React and Vue have similar rendering speeds. Vue's computed property dependency tracing means that a lot of the performance optimizations which require manual work to enable in React (manually memoize expensive computation, shouldComponentUpdate, PureComponent etc.) are handled automatically by the framework.
comment 9y ago · link · parent
comment 9y ago · link · parent
Of course it also means you can't upgrade React without upgrading Flow, and you can't target a specific (older) version of React without downgrading Flow.
comment 9y ago · link · parent
- Saying the error messages are "not intuitive" is a bit of an understatement. Most memorably, this was an actual message I was presented with after upgrading to Flow v0.53 - https://imgur.com/UseQxEz.png
- Flow's goal appears to be ensuring correctness rather than being useful. Object.value produces an array of mixed, effectively erasing their type (https://github.com/facebook/flow/issues/2174). document.body is a Maybe (https://github.com/facebook/flow/issues/4783). All use of getters and setters are marked as unsafe, with no way to selectively opt in or out (https://github.com/facebook/flow/issues/2826). These are pedantic to the point of uselessness.
- When a function call's parameter type disagrees with the function signature, Flow flips a coin and marks one of them as incorrect. GitHub issue from Oct 2016 - https://github.com/facebook/flow/issues/2587 (issue is closed because they're 'working on it', not because it's actually resolved)
- Flow's libdef is a fraction of TypeScript's. I frequently convert TypeScript libdefs to Flow libdefs. I have yet to see a library that has Flow libdef but not TypeScript libdefs.
172.
Undercover in Temp Nation(projects.thestar.com ↗)
1 points · by mediumdeviation · 9y ago · discuss
173.
The Photos the U.S. And Saudi Arabia Don’t Want You to See(nytimes.com ↗)
4 points · by mediumdeviation · 9y ago · discuss
comment 9y ago · link · parent
At least Microsoft has the good grace to put up free VMs for browser testing - https://developer.microsoft.com/en-us/microsoft-edge/tools/v...
comment 9y ago · link · parent
comment 9y ago · link · parent
<a href="...">Link 1</a> |
<a href="...">Link 2</a> |
<a href="...">Link 3</a>
It's not Link 1 | Link 2 | Link 3
as you'd expect - instead, the whitespace after the pipe character is eaten by JSX. This is because HTML is whitespace sensitive, but JS is not, and so to allow indentation, JSX trims whitespace.Here's another -
<dl>
{ Object.entries(definitions).map(([term, definition]) => (
<dt>{ term }</dt>
<dd>{ definition }</dd>
)}
</dl>
This does not work - instead, you need to return an array, but the result is ugly - the commas are part of JS, not HTML, and don't appear in the output, but reading this quickly it's hard to see that (the difference is the braces surrounding the block). <dl>
{ Object.entries(definitions).map(([term, definition]) => ([
<dt>{ term }</dt>,
<dd>{ definition }</dd>,
])}
</dl>
Vue's 'weird DSL' is HTML (the same is not quite true for Angular's). What you see is exactly what you get. Having a DSL also means you can define your own syntax. Things that are verbose (due to historical reasons in JS), such as iterating over an object, can be made simple - <dl>
<template v-for="(definition, term) in definitions">
<dt>{{ term }}</dt>
<dd>{{ definition }}</dd>
</template>
</dl>comment 9y ago · link · parent
arr[3] = 'New content';
Updating an array element immutably arr = arr.map((element, index) => {
if (index === 3) return 'New content';
return element;
});
It's possible, sure, but it feels terrible. JavaScript objects want to be mutated - it's the most idiomatic way of interacting with them. Whether functional programming paradigm is good (I certainly feel it is) is beside the point - JS wasn't designed for it.When I think of immutable primitives, I think of Python's tuples, which will raise a big fat error when you try to mutate them, or even better, Swift's structs, which gives you a new copy with every mutation.
comment 9y ago · link · parent
180.
'Hate speech' tweets painted at Twitter HQ in protest(bbc.com ↗)
1 points · by mediumdeviation · 9y ago · discuss