1. C++ / Говнокод #746

    +161.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    bool HaW::Object::DestroyMutex()
    {
    	if (0 != pthread_mutex_destroy(&pMutex))
    		if (0 == pthread_mutex_unlock(&pMutex))
    			if(0 == pthread_mutex_destroy(&pMutex))
    				return true;
    			else
    				return false;
    		else
    			return false;
    }

    Метод для освобождения мьютекса, POSIX

    guest, 19 Марта 2009

    Комментарии (1)
  2. PHP / Говнокод #745

    +140.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    ...
    
    $result = my_mysql_query($query);
    $numrows = mysql_num_rows($result);
    if ((!$result || !mysql_num_rows($result)) && $numrows !==0) {
        echo '<p>'.l('article_not_exist').'</p>';
    }
    else {
      if ($numrows) {
    
    ...

    sNews...

    guest, 19 Марта 2009

    Комментарии (4)
  3. JavaScript / Говнокод #744

    +190.8

    1. 1
    bitmap = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

    http://nm.merz-akademie.de/~alexander.schlegel/pixeledit/pixeleditor2.php

    guest, 19 Марта 2009

    Комментарии (8)
  4. C++ / Говнокод #743

    +144.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
     if ((timeinfo->tm_mon + 1) < 10)
        tmp_file << "0" << timeinfo->tm_mon + 1;
     else
        tmp_file << timeinfo->tm_mon + 1;
     
    if (timeinfo->tm_mday < 10)
       tmp_file << "0" << timeinfo->tm_mday << ";";
    else
       tmp_file << timeinfo->tm_mday << ";";
    
    if (timeinfo->tm_hour < 10)
        tmp_file << "0" << timeinfo->tm_hour << ":";
    else
        tmp_file << timeinfo->tm_hour << ":";
    
    if (timeinfo->tm_min < 10)
        tmp_file << "0" << timeinfo->tm_min << ":";
    else
        tmp_file << timeinfo->tm_min << ":";
    
    if (timeinfo->tm_sec < 10)
        tmp_file << "0" << timeinfo->tm_sec;
    else
        tmp_file << timeinfo->tm_sec;

    Что бы вы думали код делает?
    формирует дату в стиле "YYYYMMDD;HH:MM:SS"
    Про setw мы не слышали и на крайний случай в Си стиле "%02d" тоже :(

    guest, 19 Марта 2009

    Комментарии (0)
  5. ActionScript / Говнокод #742

    −348

    1. 1
    if (songName != null || generatedName != null, userId != null)

    я плачу, чоткое условие...

    guest, 19 Марта 2009

    Комментарии (4)
  6. PHP / Говнокод #741

    +138

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    .inputPassword {
      border: 1px solid #C0CAD5;
      font-family: tahoma, tahoma, verdana, arial, sans-serif;
      font-size: 11px;
      padding: 3px;
    }

    C сайта http://vkontakte.ru/
    CSS http://vkontakte.ru/css/rustyle.css
    tahoma два раза написана, чтож не десять.

    guest, 18 Марта 2009

    Комментарии (2)
  7. C++ / Говнокод #740

    +146.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    for (int i = (orientation == Qt::Horizontal ? x : y); i < x+size; ++i)
        addPipe(orientation == Qt::Horizontal ? i : x, 
                orientation == Qt::Horizontal ? y : i, 
                orientation == Qt::Horizontal,
                orientation == Qt::Horizontal,
                orientation != Qt::Horizontal,
                orientation != Qt::Horizontal,
                randomRotation);

    guest, 18 Марта 2009

    Комментарии (1)
  8. PHP / Говнокод #739

    +142

    1. 1
    2. 2
    3. 3
    if ('' == trim($params['password'])) {
        echo 'Password cannot be empty';
        ..............

    проверка на пустоту

    guest, 18 Марта 2009

    Комментарии (10)
  9. PHP / Говнокод #738

    +139

    1. 1
    2. 2
    3. 3
    >?php
    echo; print"hui"
    ?>

    пехепе

    guest, 18 Марта 2009

    Комментарии (1)
  10. PHP / Говнокод #737

    +155.9

    1. 1
    2. 2
    $names = explode('_', $className);
    $fileName = join('/', $names) . '.php';

    Супер замена символов в строчке :)
    Это из куска нынче модной функции __autoload() :)

    guest, 18 Марта 2009

    Комментарии (5)