WCF / LRC

May those who say to me, "Aha! Aha!" turn back because of their shame.
http://ohai.ca/bible/
0 stars 1 forks source link

Automatic table-of-contents generation for Programs and About pages (a.k.a. I can PHP!) #17

Closed WarttHog closed 11 years ago

WarttHog commented 11 years ago

Brian, please please please code review this! This is literally the first PHP code I've ever written so any comments are appreciated.

Known issues:

WarttHog commented 11 years ago

:O DUDE! Check out the number of added lines!

WarttHog commented 11 years ago

Hold on, hold on. I forgot a file and apparently used too-new a PHP feature. Uno momento.

WarttHog commented 11 years ago

Okay, give that a shot...

1337 commented 11 years ago

Yeah, php is a hole. You couldn't do [] until 5.4.

WarttHog commented 11 years ago

1) The [] commit changed the number of lines added. It used to be 1337! :)

2) Escaping: This isn't as straight-forward as you might think. We'll talk tonight.

3) Performance: I'm not concerned about running the regexes but I am slightly concerned about opening all of those files. I had an idea to cache the TOC in another file and only regenerate it if some filestamp was newer than this cache, but that sounded a bit ambitious for my first script ever. I'm up for trying it if you think it'd be worth it. Right now though we have only 17 programs and 7 about pages, not 50. I figured it would be rare enough for anyone to hit about or program pages that we could get away with this. We can discuss tonight.

4) Double-quote strings: I thought string interpolation was one of PHP's strengths. It's one of the things I actually like about Perl. I can dot them together if you'd sleep better at night but if it was just me I'd leave it.

5) Case-insensitive regexes: Totally agree. Done.

6) Array literals: This I knew but I was scratching my head trying to figure out how Sarah's apache was running an older version of PHP than mine.