Today I Learned - Rocky Kev

Tagged “math”

  1. TIL math module in SASS!

    math in Sass, oh my!

  2. TIL the Quake 3 Fast Inverse Square Root hack

    Quake III Arena, a first-person shooter video game, was released in 1999 by id Software and used the algorithm.

  3. TIL that the max size of a Map/Set is 26843544

    JS Maps and Sets are implemented by OrderedHashTable. OrderedHashTables double in size when they need to grow, and their max size is 26843544. After 16777216 elements, doubling that exceeds the max, so the allocation fails.Currently these data structures are not implemented to be usable for large in-memory datasets. Also note that the JS specification itself doesn't require that Maps and Sets must scale with available memory.

  4. TIL the WebCrypto API

    If you dealing with sensitive applications and need a more secure method of randomization, I’d recommend the Crypto API. Reasons you may want to use WebCrypto include temporary verification codes, random password generation, randomized lottery numbers, etc.

  5. TIL the origins of the term Algorithms

    Muhammad ibn Musa al-Khwarizmi's name is a reference to where he was from — 'al-Khwarizm' means that he was from Khwarazm, a region roughly on the border of modern-day Uzbekistan and Turkmenista. Al-Khwarizmi was, somehow, recorded as something close to 'Algorizmi' which, in turn, became our all-purpose math word: algorithm.

  6. TIL that 2^24 items will cause a interesting error

    Obviously there's not much real use-cases. But that's the fun of finding limitations.

  7. TIL how to get a random Hex color

    Math.random()*16777215 then turn it into a

  8. TIL how to convert RGB to HEX to RGB again

    It's all just math! AAAAH!

  9. TIL the XOR operator in Javascript

    The operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones).

  10. TIL minus minus plus

    Well technically true, don't do this. Ever.

  11. TIL Higher Order functions to reduce loops

    Higher Order Functions like Sum, Map, Filter, Reduce

  12. TIL Avoiding Off-by-one errors and state using Recusion

    Recursion is a function that calls itself.

  13. TIL Stateful and stateless

    An expression in a programming language can be “stateful” or “stateless”.

  14. TIL One-by-one errors

    An off-by-one error is when you expect something to be of value N, but in reality it ends up being `N-1` or `N+1`.

  15. TIL the problem with using Loops

    Loops tend to have some flaws. Instead use Higher Order Functions

See all tags.