Ten Lines Of Code That Changed My World

27 points by carlana 8 hours ago on lobsters | 6 comments

tombh | 6 hours ago

May I add my own:

OPEN "filename.txt" FOR BINARY AS #1
PRINT INT(LOF(1) / 5.1)
CLOSE #1

I was born in the early 80s. My father was a programmer then and would read Computer Weekly magazine. They'd have regular competitions to write simple programs, which would be marked for things like speed, complexity and accuracy. My father told me about a time the challenge was to write a word counter. He walked me through the basic ideas, like looping through characters and counting spaces. But what about the multiple spaces between paragraphs and hyphenated words? It wasn't as simple as it seemed. He was setting me up to appreciate the winner. No for loops, no exceptions, just divide the file size by 5.1, the average length of a word in the English language.

He really laid a seed in me with that story. How intriguing that, as long as the file wasn't too small, such a simple trick could compete on accuracy with more "correct" solutions. I saw that programming wasn't just a mechanical task but one of creativity, flair and surprise.

susam | 4 hours ago

Mine was: FD 100

gavinmorrow | 3 hours ago

Me too! I started with the comic book series Secret Coders. It taught Logo with a bunch of plot mixed in. Super fun.

donio | 3 hours ago

Using the name touch for a command that silently wipes out the content of existing files sounds like a very bad idea. The real touch command doesn't do that of course.

isagalaev | 4 hours ago

I always preferred outline to border for CSS debugging as it doesn't change the size of the box.

tonyarkles | 2 hours ago

POKE 36879, __