1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #2058

    +156.3

    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
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    final class HelperCurrency {
      
      	public function format($number, $currency = '', $value = '', $format = TRUE) {
    		/*** .... some code .... ***/
        	if ($value) {
          		$value = $value;
        	} else {
          		$value = $this->currencies[$currency]['value'];
        	}
    
        	if ($value) {
          		$value = $number * $value;
        	} else {
          		$value = $number;
        	}
    
    		/*** .... some code .... ***/
    		
    		if ($format) {
    			$decimal_point = $this->language->get('decimal_point');
    		} else {
    			$decimal_point = '.';
    		}
    		
    		if ($format) {
    			$thousand_point = $this->language->get('thousand_point');
    		} else {
    			$thousand_point = '';
    		}
    
    		/*** .... some code .... ***/
      	}
    }

    класика от OpenCart v. 1.3.2

    Under, 27 Октября 2009

    Комментарии (2)
  3. Java / Говнокод #2050

    +77.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    // Год и месяц редактируются как Double, а хранятся в  базе как два инта
                    if (aValue == null) {
                        current.setStartMonth(0);
                        current.setStartMonth(0);
                    } else {
                        current.setStartMonth(Integer.parseInt(aValue.toString().split(".")[0]));
                        current.setStartMonth(Integer.parseInt(aValue.toString().split(".")[1]));
                    }

    Программисты клиента и базы стоят один другого

    Jk, 27 Октября 2009

    Комментарии (2)
  4. VisualBasic / Говнокод #2026

    −129.8

    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
    For intAtts As Integer = 5 To strParams.Length - 1
                Select Case (intAtts + 1) Mod 3
                    Case 0
                        '--- Set where to find the attachments
                        Select Case strParams(intAtts).ToUpper
                            Case "TASKVIEW"
                                strAttach = CType(Me.Parent, ctlTaskViewTemplate).ctlDocNavigator.ContainerID.ToString & ","
                            Case "WORKITEM"
                                strAttach = WorkItem.WorkItemContainer.ToString & ","
                            Case "CASE"
                                strAttach = BFECase.CaseContainerID.ToString & ","
                        End Select
                    Case 1
                        '--- Set the relative path of where to find the attachments
                        strAttach = strAttach & strParams(intAtts) & ","
                    Case 2
                        '--- Set the type of document used to find the attachments
                        strAttach = strAttach & strParams(intAtts)
                        arrAttachments.Add(strAttach)
                        strAttach = ""
                End Select
            Next intAtts

    вот и попробуй пойми что в этих массивах по какому принципу лежит

    6istik, 22 Октября 2009

    Комментарии (2)
  5. Java / Говнокод #2013

    +77.5

    1. 1
    2. 2
    3. 3
    4. 4
    //devPin и pin - массивы байт, а сравниваем мы их так :
    
    if (Utils.bytesToHex(devPin).equals(Utils.bytesToHex(pin))) {
    ....

    :)))

    tuba.linux, 21 Октября 2009

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

    +151.9

    1. 1
    if ($startTime == $endTime || $endTime < $startTime) {

    Написал, ужаснулся и тут же переписал

    striker, 30 Сентября 2009

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

    +151.2

    1. 1
    <?=trim(base64decode(trim($_GET['zzz'])))?>

    Ну как-то вот так

    McLeod, 25 Сентября 2009

    Комментарии (2)
  8. Java / Говнокод #1889

    +65

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if (s.length() < 2)
                return false;
    if (s.charAt(1) == ':') {
                return true;
    }
    return false;

    lian, 23 Сентября 2009

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

    +156.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    array_walk($additional_constraints_arr, create_function('&$field_value, $field_dest', '$field_value = (substr($field_dest, -1) == "!" ? "' .
        $table . '.' . ($prepend_table_name ? make_singular($table) . '_' : '') . '" . 
        substr($field_dest, 0, -1) . " != " . "\"" . $field_value . "\"" : (substr($field_dest, -1) == "%" ? "LOWER(" . "' .
        $table . '.' . ($prepend_table_name ? make_singular($table) . '_' : '') . '" . 
        substr($field_dest, 0, -1) . ") LIKE " . "LOWER(\"%" . $field_value . "%\")" : (substr($field_dest, -1) == "~" ? "' .
        $table . '.' . ($prepend_table_name ? make_singular($table) . '_' : '') . '" . 
        substr($field_dest, 0, -1) . " = " . $field_value : "' . 
        $table . '.' . ($prepend_table_name ? make_singular($table) . '_' : '') . '" . ' .
        '$field_dest . " = " . "\"" . $field_value . "\"")));'));

    ... just a simple 'WHERE' clause expanded to Godzilla-size ...

    core-ix, 10 Сентября 2009

    Комментарии (2)
  10. Perl / Говнокод #1793

    −103

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    foreach my $current_item(@catalog_items)
    {
        foreach($current_item)
        {
            my $id = $_->[0];
            ...

    Suor, 09 Сентября 2009

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

    +159

    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
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    <?
    $vars=array("№1" => "volvo", "№2" => "saab","№3" => "saab & audi", "№4" => "mercedes","№5" => "audi");
    	echo "<table border=1>";
    	foreach ($vars as $k => $v) {
    		echo "<tr><td>".$k."</td><td>".$v."</td></tr>";
    	}
    	echo "</table>";
    ?>
    
    
    <form action="index.php" method="POST">
    <select name="parametr">
      <option value="volvo">Volvo</option>
      <option value="saab">Saab</option>
      <option value="saabandaudi">Saab & Audi</option>
      <option value="mercedes">Mercedes</option>
      <option value="audi">Audi</option>
    </select>
    <input type="submit" value="JMI">
    </form>
    
    <?
    
    if (isset($_POST['parametr']) && !empty($_POST['parametr'])) {
    	
    	foreach ($vars as $k => $v) {
    		if (strstr(strtolower($v),strtolower($_POST['parametr']))) {
    			echo $k." - ".$vars[$k]."<br>";
    		}
    	}
    } else {
    	echo "<table border=1>";
    	foreach ($vars as $k => $v) {
    		echo "<tr><td>".$k."</td><td>".$v."</td></tr>";
    	}
    	echo "</table>";
    }
    ?>

    dsda, 05 Сентября 2009

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