My top 3 (as mainly JS dev) would be:
- Number overflow. It happens when you’re backend send big number ID serialized in a JSON. The solution is to wrap the number into a
string
when you know that can happens.
JSON.parse('{"n": 123456789123456789012.0}').n
// => 123456789123456800000
- Mutating an Object by ref (now I use
Object.freeze
a lot). Something like:
const CONFIGURATION = { conf: { enabled: false } }
// setup a "copy"
let currentConfiguration = { ...CONFIGURATION }
currentConfiguration.conf.enabled = true
// try to reset the conf
currentConfiguration = { ...CONFIGURATION }
// => { conf: { enabled: true } }
- Assignation instead of comparison (now my IDE warn me)
if (foo = false) {
// do something
}
The API of ListenBrainz is really simple. I built a simple MPV script to send my listenned tracks to ListenBrainz in few hours. It does the job pretty well, and I submitted almost 50K records.
For the moment I didn’t do anything with it, but I know I could someday.