News for hackers. Stuff that matters.
Re:Ruby Methods Are Colorless by williamcotton on Tuesday July 23, 2024 @09:43AM (#41045952)
Here's three different ways to write a small shell script that turns letters into uppercase:

Node:

  let inputData = '';
  process.stdin.on('data', 
    chunk => inputData += chunk
  );
  process.stdin.on('end',
    () => console.log(inputData.toUpperCase())
  );
Python:

  import sys
  sys.stdout.write(
    sys.stdin.read().upper()
  )
Ruby:

  puts $stdin.read.upcase
Re:Ruby Methods Are Colorless by racketprogram on Tuesday July 23, 2024 @09:52AM (#41046048)
console.log(require('fs').readFileSync(0).toString().toLowerCase())