Mai 30 2012

No exceptions

Christoph

Thanks to Tobias for this code candy

return verify_iban($this->iban);
# we could throw exceptions of various types, but why -
# does it really add anything? possibly some slightly
# better user feedback potential. however, this can be
# written by hand by performing individual checks ala
# the code in verify_iban() itself where required, which
# is likely almost never. for the increased complexity
# and maintenance / documentation cost, i say,
# therefore: no. no exceptions.

Source: Direct link to the source code
Software: php-iban
Programming language: PHP

1 Star2 Stars3 Stars4 Stars5 Stars (3 Bewertungen, Durchschnitt: 4,67 von 5)
Loading ... Loading ...

Apr 3 2012

God were we wrong

Christoph

Thanks to Andi for this code candy

/**
this code does more than necessary. this was because we thought we could leave the parameters optional. god were we wrong…
*/

Programming language: PHP

1 Star2 Stars3 Stars4 Stars5 Stars (1 Bewertungen, Durchschnitt: 4,00 von 5)
Loading ... Loading ...

Dez 6 2011

this needs to be explained

Christoph

Thanks to David for this code candy

// this needs to be explained!!
$this->_searchResult[$type] = $this->_searchResult[$type];

Programming language: PHP

1 Star2 Stars3 Stars4 Stars5 Stars (4 Bewertungen, Durchschnitt: 4,50 von 5)
Loading ... Loading ...

Apr 13 2011

Please increment the following counter

Christoph

Thanks to Markus B. for this code candy

/**
 * Once you are done trying to ‘optimize’ this routine,
 * and have realized what a terrible mistake that was,
 * please increment the following counter as a warning
 * to the next guy:
 *
 * total_hours_wasted_here = 11
 */

Programming language: PHP

1 Star2 Stars3 Stars4 Stars5 Stars (8 Bewertungen, Durchschnitt: 4,75 von 5)
Loading ... Loading ...

Mrz 28 2011

But for now…

Christoph

Thanks to Sebastian R. for this code candy

// the two salts for the password. I know it could be safer
// with random salts but for now it’s okay

Source: found in an old configuration file in third-party software
Programming language: PHP

1 Star2 Stars3 Stars4 Stars5 Stars (3 Bewertungen, Durchschnitt: 3,33 von 5)
Loading ... Loading ...