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

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

    +162

    1. 1
    2. 2
    $('html body table tbody tr td:nth-child(2) table tbody tr td table:nth-child(1) tbody tr:nth-child(2) td table tbody tr td:nth-child(2)')
    from stackoverflow

    computer1, 04 Июня 2013

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

    +162

    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
    function closeLayerInSite(layerName) {
        if (layerName != "count_result") $("#count_result").fadeOut(200);
        if (layerName != "subscribe_layer") $("#subscribe_layer").fadeOut(200);
        if (layerName != "online_contact") $("#online_contact").fadeOut(200);
        if (layerName != "faq_layer") $("#faq_layer").fadeOut(200);
        if (layerName != "layerCity") $("#layerCity").fadeOut(200);
        if (layerName != "ur_service_layer") $("#ur_service_layer").fadeOut(200);
        if (layerName != "fiz_service_layer") $("#fiz_service_layer").fadeOut(200);
        if (layerName != "requestRateMain_layer") $("#requestRateMain_layer").fadeOut(200);
        if (layerName != "exchange_calc") $("#exchange_calc").fadeOut(200);
        if (layerName != "universalForm") $("#universalForm").fadeOut(200);
        if (layerName != "layerCityes") $("#layerCityes").fadeOut(200);
        if (layerName != "vacancy") $("#vacancy").fadeOut(200);
        if (layerName != "cardsAnnotation") $("#cardsAnnotation").fadeOut(200);
        $("#content").css("padding", "0 0 280px");
    }

    Реальный JS-код от самого коммерческий эффективного ТИМЛИДА!

    validol, 29 Мая 2013

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

    −110

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Amount_List=[[NSArray alloc] initWithObjects:@"500",@"1000",@"2000",@"5000",@"10000",@"25000",@"50000",@"100000",@"250000",@"350000",@"500000",@"1000000",nil];
    	
    
    	//ShowWonAmout
    	NSString *str1=[NSString stringWithFormat:@"%@",[currencyStyle stringFromNumber:[NSNumber numberWithInt:[[Amount_List objectAtIndex:0] intValue]]]];
    	ShowAmount1.text=[str1 substringToIndex:[str1 length]-3];
            ...	
    	NSString *str12=[NSString stringWithFormat:@"%@",[currencyStyle stringFromNumber:[NSNumber numberWithInt:[[Amount_List objectAtIndex:11] intValue]]]];
    	ShowAmount12.text=[str12 substringToIndex:[str12 length]-3];

    Коллега принес покушать плоды трудов ребят из солнечной Индии

    clockworkman, 29 Мая 2013

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

    +149

    1. 1
    $this->t = (date('w')+1)>6?0:(date('w')+1);

    фак мой мозг

    CRRaD, 13 Мая 2013

    Комментарии (6)
  6. Java / Говнокод #12988

    +69

    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
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    package javaapplication4;
    import java.util.Scanner;
    
    public class JavaApplication4 {    
        public static void main(String[] args) {            
            int powerOfTwo[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536};
            int lengthOfHammingCode = 0;      
            Scanner in = new Scanner(System.in);
            System.out.print("Введите двоичное число, которое хотите закодировать: "); String code = in.nextLine();
            in.close();
            if (code.length() < 2) System.out.println("Слишком маленькое число.");
            
            boolean controlBits[] = new boolean[code.length()*2+1]; 
            int i = 0;
            
            //---------------ВЫЧИСЛЯЕМ ДЛИНУ КХ И КОНТРОЛЬНЫЕ БИТЫ------------------
             do {        
                 controlBits[powerOfTwo[i]] = true;
                 i++;
            } while (powerOfTwo[i] <= (code.length()+1)); // Цикл ищет такую НАИМЕНЬШУЮ степень двойки, которая > либо = длине входного кода.
             
            lengthOfHammingCode = code.length() + i;   
            //----------------------------------------------------------------------
            
            //-------------ЗАПИСЫВАЕМ ВВЕДЁННЫЙ КОД С КОНТРОЛЬНЫМИ БИТАМИ-----------
            boolean hammingCode[] = new boolean[lengthOfHammingCode];       
            int j = 0;
            for (i = 0; i < lengthOfHammingCode; i++) { // Устанавливаем биты для промежуточного кода. 
                if (!controlBits[i+1]) {
                    hammingCode[i] = (code.charAt(j) == '1');
                    j++;
                }
            }
            //----------------------------------------------------------------------
            
            System.out.print("Промежуточный код с контрольными битами: [");
            for (int k = 0; k < lengthOfHammingCode; k++) {
                char c = (hammingCode[k]) ? '1' : '0';
                if (controlBits[k+1]) System.out.print("!");
                System.out.print(c);
            }
            System.out.print("]\n");
            
            //---------------------ВЫЧИСЛЯЕМ ЗНАЧЕНИЕ КОНТРОЛЬНЫХ БИТ----------------
            for (i = 0; i < (lengthOfHammingCode - code.length()); i++) { // Цикл проходится по всем контрольным битам.
                boolean nextBit = false;         
                for (j = powerOfTwo[i]-1; j < lengthOfHammingCode; j += powerOfTwo[i]*2) {
                    for (int n = j; n < j + powerOfTwo[i]; n++) {
                        if (n > lengthOfHammingCode - 1) break;
                        nextBit ^= hammingCode[n]; // Ксорим со следующим битом
                    }             
                }           
                hammingCode[powerOfTwo[i]-1] = nextBit; // Записываем значение i-ного бита.
            }
            //----------------------------------------------------------------------
            
            System.out.print("Код Хемминга с контрольными битами: [");
            for (int k = 0; k < lengthOfHammingCode; k++) {
                char c = (hammingCode[k]) ? '1' : '0';
                System.out.print(c);
            }
            System.out.print("]\n"); 
        }
    }

    Реализация вычисления кода Хемминга по заданному двоичному коду.

    Govnocoder#0xFF, 13 Мая 2013

    Комментарии (6)
  7. Java / Говнокод #12968

    +82

    1. 1
    getField().setText(objToString(stringToObj(getField().getText())));

    Moloth, 06 Мая 2013

    Комментарии (6)
  8. JavaScript / Говнокод #12933

    +170

    1. 1
    if (window.IsLocking !== [].xxx)

    Проверка на undefined

    Zergatul, 22 Апреля 2013

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

    +142

    1. 1
    var_dump( ((int) 0 == (string) "test") ); // TRUE

    Бляааа...

    deep, 20 Апреля 2013

    Комментарии (6)
  10. C# / Говнокод #12917

    +132

    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
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    <div class="breadcrumbs">
      <ul>
        <li>
          @if (curMenu != null)
          {
            <a href="@Url.Action("index", "main")">Главная</a><span class="breadcrumbs__dash"> / </span>
            if (depth == 1)
            {
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 2)
            {
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a> <span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 3)
            {
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 4)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 5)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 6)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 7)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 8)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }                                  
          }
          else if (ViewBag.Title != null && url!="/")
          {
            <a href="@Url.Action("index", "main")">Главная</a><span class="breadcrumbs__dash"> / </span>
            <span>@ViewBag.Title</span>
          }
        </li>
      </ul>
    </div>

    Хлебные крошки в каталоге "неограниченной" вложенности.

    validol, 19 Апреля 2013

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

    +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
    if(@$_POST['submit']) {
            
    	$title = "title";
    	$string = "";
    	$equal = "=";
    	$amper = "&";
            $to = '[email protected]';
            $from='[email protected]';
    
    	foreach($_POST as $key => $value) {
    		foreach($value as $v) {
    			$string=$string.$key.$equal.$v.$amper;
    		}
    	}
    
            mail($to, $title, $string, 'From:'.$from);
    }

    clauclauclau, 04 Апреля 2013

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