News for hackers. Stuff that matters.
Re:Math.min(Math.max(num, min), max) by boxfire on Thursday August 20, 2020 @10:44AM (#24223804)
I think this was posted purely for the limerick quality.
Re:Math.min(Math.max(num, min), max) by hanoz on Thursday August 20, 2020 @12:33PM (#24225006)

  There was a young coder whose hacks
  His manager often claimed lacked
  The requisite clarity
  For to clamp vars would he:
  Math.min(Math.max(number, min), max);
Re:Math.min(Math.max(num, min), max) by drbacon on Thursday August 20, 2020 @01:45PM (#24226127)

    @jaffathecake had a problem of truncation
    and posted to Twitter his calculation.
    The gist of his attack
    was min( max( num, min ), max)
    yet refused to add any annotation.
Re:Math.min(Math.max(num, min), max) by jkaptur on Thursday August 20, 2020 @12:48PM (#24225292)
In a file of utility hacks

near get(), post(), and ajax()

// we alias at import

// to keep all the code short

min(max(number, min), max)

Re:Math.min(Math.max(num, min), max) by gmfawcett on Thursday August 20, 2020 @03:53PM (#24227998)
Haiku is nice, too:

    Cryptic sorcerer!
    "Math.min(Math.max(v, min), max);"
    his incantation.