TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Programmer's Nightmare – Ruby Prank

14 pointsby ace_33about 9 years ago

6 comments

TheDongabout 9 years ago
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 = &quot; &quot; ARGF.inplace_mode = &quot;&quot; ARGF.each_line do |line| print line.gsub(&quot; &quot;, bad_whitespace) end </code></pre> 5) bad commenting. The style of commenting each line for what it does is often silly. Something like &quot;fileModified.close # Close file&quot; tells me exactly nothing more than reading the code. Having &quot;noisy&quot; 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 &quot;you&#x27;re required to have at least this much commenting&quot;, or a beginner programmer.<p>And finally, this is obviously a dumb toy program.<p>This isn&#x27;t useful to show-hn. This isn&#x27;t anything novel, or even interesting. It&#x27;s not hard to do. It&#x27;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&#x27;s a good idea; see that other people think it&#x27;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&#x27;ve got a project you&#x27;re proud of that has seen some use besides yourself, seen at least one other happy user, and relates to HN&#x27;s interests, post away!
评论 #11359163 未加载
评论 #11359168 未加载
kzarabout 9 years ago
Even worse, we actually had a regression at work caused by a zero width space sneaking into some code. Most editors won&#x27;t even display anything for that character, even the code review tool we used didn&#x27;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:&#x2F;&#x2F;github.com&#x2F;kzar&#x2F;emacs.d&#x2F;blob&#x2F;master&#x2F;init.el#L181-L191" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kzar&#x2F;emacs.d&#x2F;blob&#x2F;master&#x2F;init.el#L181-L19...</a>
评论 #11359085 未加载
illektr1kabout 9 years ago
Along the same vein: Things to commit just before leaving your job - <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;aras-p&#x2F;6224951" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;aras-p&#x2F;6224951</a>
wmtabout 9 years ago
Why would you want to do that with ruby script instead of your favorite editor, or tr&#x2F;sed on the commandline? And why would you write a &quot;Close file&quot; comment before file.close?
pmlnrabout 9 years ago
<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10437619" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10437619</a>
akerroabout 9 years ago
git checkout - uf