Critique:<p>1) no LICENSE file<p>2) not configurable<p>3) not idiomatic ruby (e.g. camelCase not snake_case)<p>4) overtly complicated. A better, and shorter version, is:<p><pre><code> bad_whitespace = " "
ARGF.inplace_mode = ""
ARGF.each_line do |line|
print line.gsub(" ", bad_whitespace)
end
</code></pre>
5) bad commenting. The style of commenting each line for what it does is often silly. Something like "fileModified.close # Close file" tells me exactly nothing more than reading the code. Having "noisy" comments makes important comments less obvious, and thus actually makes the overall commenting worse.<p>This is a sign of a college coder who had some class where the teacher said "you're required to have at least this much commenting", or a beginner programmer.<p>And finally, this is obviously a dumb toy program.<p>This isn't useful to show-hn. This isn't anything novel, or even interesting. It's not hard to do. It's poorly implemented and not portable (really, why require the user to edit the filename? ARGF exists for a reason).<p>This was also submitted by a new hn account mere hours after it was created (clearly by the author). I have no problem with showing off your own work, but at least let it cool down to see if it's a good idea; see that other people think it's interesting or useful in its own right.<p>I consider presenting an essentially 5-line program that is not generally useable or insightful as being basically spam.<p>I do recommend keeping on programming and, once you've got a project you're proud of that has seen some use besides yourself, seen at least one other happy user, and relates to HN's interests, post away!
Even worse, we actually had a regression at work caused by a zero width space sneaking into some code. Most editors won't even display anything for that character, even the code review tool we used didn't!<p>In the end I configured Emacs to highlight all unicode characters, trailing whitespace and tabs bright red. I also had it render zero width characters as normal spaces, otherwise they were still invisible. <a href="https://github.com/kzar/emacs.d/blob/master/init.el#L181-L191" rel="nofollow">https://github.com/kzar/emacs.d/blob/master/init.el#L181-L19...</a>
Along the same vein: Things to commit just before leaving your job - <a href="https://gist.github.com/aras-p/6224951" rel="nofollow">https://gist.github.com/aras-p/6224951</a>
Why would you want to do that with ruby script instead of your favorite editor, or tr/sed on the commandline? And why would you write a "Close file" comment before file.close?