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

    В номинации:
    За время:
  2. Куча / Говнокод #2810

    +124.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
    varnamebegin // начало имени новой переменной
    a // имя новой переменной
    varnameend // конец имени новой переменной
    varvaluebegin // начало значения новой переменной
    newarray // новый массив
    varvalueend // конец значения новой переменной
    varcallbegin // начало имени вызываемой переменной
    a // имя вызываемой переменной
    varcallend // конец имени вызываемой переменной
    push // добавить элементы в массив
    lcobjectsbegin // начало области добавляемых элементов
    bg // начало значения элемента массива
    codedn // code — символ, d — префикс для цифр, n — спец-символ для цифры "0"
    end // конец значения элемента массива
    bg // начало значения элемента массива
    codedo // code — символ, d — префикс для цифр, n — спец-символ для цифры "1"
    end // конец значения элемента массива
    lcobjectsend // конец области добавляемых элементов
    functioninit // аналог ()

    Создание массива с содержимым [0, 1] на одном из эзотерических ЯП. Фишка в том, что убраны все знаки препинания, цифры и т.д., оставлены лишь прописные латинские буквы.
    Интересно, как на таком ЯП будет выглядеть полностью валидная проверка E-Mail (наподобии этой — ex-parrot.com/pdw/Mail-RFC822-Address.html) ?

    eval, 17 Марта 2010

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

    +111.6

    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
    private ArrayList MNK(Matrix x, ArrayList y) {
    
                normalization(ref x);
    
                
    
                for (int i = 0; i < x.N; i++)
    
                    for (int j = 0; j < x.M; j++)
    
                        x.data[i, j] = Chebyshev.function(x.data[i,j],POWER_POLYNOM);
    
    
    
                Matrix yNew = Matrix.CreateMatrixFromArrayList(y);
    
                Matrix tranc = x.Tranc_Matrix(x);
    
                Matrix temp = x.Obernena_Matrix(x.Mul_Matrix(tranc, x));
    
                temp = x.Mul_Matrix(temp, tranc);
    
                temp = x.Mul_Matrix(temp, yNew);
    
                yNew = yNew.Mul_Matrix(x,temp);
    
    
    
                    return (returnValue(yNew, y));
    
            }
    
    
    //****************************************************
     #region
    
            private static ArrayList returnValue(Matrix yNew, ArrayList y)
    
            {
    
                ArrayList t = new ArrayList();
    
                Random r = new Random();
    
                double k = 2;
    
    
    
                for (int i = 0; i < y.Count; i++)
    
                {
    
                    if (y.GetHashCode() == y1.GetHashCode())
    
                        k = 1;
    
                    if (y.GetHashCode() == y2.GetHashCode())
    
                        k = 4000;
    
                    if (y.GetHashCode() == y3.GetHashCode())
    
                        k = 1000000;
    
    
    
                    t.Add((double)y[i] + ((double)(r.NextDouble() * k - k/2)));   
    
                }
    
                return t;           
    
            }
    
            #endregion

    вот как тру системные аналитики пишут свои прогнозы))))))))))

    white, 07 Марта 2010

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

    +157.4

    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
    while (count(array_diff(array_keys($rows), $roots)) > 0) 
    		{
    			 $theLeaves = $this->_getLeaves($rows);
    			 foreach ($theLeaves as $leafId) 
    			 {
    			 	if(isset($rows[$rows[$leafId]['parent_id']]['Menu']['data']) and 
                                               !is_array($rows[$rows[$leafId]['parent_id']]['Menu']['data']))
    			 		if(!is_array($rows[$rows[$leafId]['parent_id']]['Menu']['data']))
                                                   unset($rows[$rows[$leafId]['parent_id']]['Menu']['data']);
                                            
    				  if(isset($rows[$rows[$leafId]['parent_id']]['data']) and 
                                            !is_array($rows[$rows[$leafId]['parent_id']]['data']))
    			 	     if(!is_array($rows[$rows[$leafId]['parent_id']]['data']))
                                                unset($rows[$rows[$leafId]['parent_id']]['data']);
                                         
    				  $rows[$rows[$leafId]['parent_id']]['data'][] = $rows[$leafId];
    				  unset($rows[$leafId]);
    			 }
    		}

    пришел проектик на доработку. сижу, пытаюсь разобраться

    gesper, 04 Марта 2010

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

    +75.4

    1. 1
    2. 2
    3. 3
    4. 4
    if (!Float.valueOf("0.0").equals(price.getActualPrice()))
    {
    	return true;
    }

    Сравнение чисел (float) нездоровым способом.

    asolntsev, 04 Марта 2010

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

    +166.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    function smla(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+=':)';}
    function smls(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+='>( ';}
    function smld(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+=':D';}
    function smlf(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+='B)';}
    function smlg(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+='%)';}
    function smlh(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+=':(';}
    function smlj(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+=':o';}
    function smlw(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+='^_^';}
    function smlk(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+='<_<';}
    function smll(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+=';)';}
    function smlq(){parent.window.document.getElementById('soob').focus();parent.window.document.getElementById('soob').value+=':p';}

    Ещё один китаец. Вставляет смайлы в текстовое поле вот таким вот кодом. Источник — http://mirtorrent.ru/css/pppm.js

    Infamous, 03 Марта 2010

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

    +161.8

    1. 1
    $tpl->assign("L_OPENER", ($arr[7] == 40 || $arr[7] == 41 || $arr[7] == 42) ? 'opener.opener' : 'opener');

    Вот так в один из шаблонов в зависимости от одного из параметров передаётся сами видите что. Почему так? Потому что бесчётное количество людей переделывали код. По мне, так это уже перебор.

    nechin, 25 Февраля 2010

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

    +163.2

    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
    var idTa;        //id of the textarea (param to makeWhizzyWig)
    //OTHER GLOBALS
    var oW, sel, rng, papa, trail, ppw, wn=window; //Whizzy contentWindow, current sel, range, parent, DOM path, popwindow;
    var sels='';
    var buts=''; 
    var vals=new Array();
    var opts=new Array();
    var dobut=new Array();
    
    //...
    w('<div style="width:'+taWidth+'" onmouseover="c(\''+idTa+'\')"><div id="CONTROLS'+idTa+'" class="wzCtrl" unselectable="on">');
    //...
    function c(id) {//set current whizzy
     if (id=="" || whizzies.join().indexOf(id)=='-1') return;
     if (id!=idTa){
      idTa=id;
      try {oW=o("whizzy"+id).contentWindow;} catch(e){alert('set current: '+id);}
      if (oW) {if(oW.focus)oW.focus();wn.status=oW.document.body.id; }
     }
    } 
    //...

    Хтоническое порождение сумрачного гения
    Все параметры редакторы лежат в global'ах. Но что делать если редакторов на странице несколько?
    Правильно: mouse over!
    http://www.unverse.net/wysiwyg.html

    turdman, 25 Февраля 2010

    Комментарии (7)
  9. Куча / Говнокод #2646

    +124.6

    1. 1
    <td width:6px="">

    Без комментариев...

    TuXAPuK, 21 Февраля 2010

    Комментарии (7)
  10. JavaScript / Говнокод #2615

    +170.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
    // http://userscripts.org/scripts/review/23705
    		var replyBoxContentPostAreaTableSubjectRowRightColumnSubmitButton = document.createElement("input");
    
    		replyBoxContentPostAreaTableSubjectRowRightColumnSubmitButton.setAttribute("type", "submit");
    
    		replyBoxContentPostAreaTableSubjectRowRightColumnSubmitButton.setAttribute("value", "Submit");
    
    		replyBoxContentPostAreaTableSubjectRowRightColumn.appendChild(replyBoxContentPostAreaTableSubjectRowRightColumnSubmitButton);
    
    		replyBoxContentPostAreaTableSubjectRow.appendChild(replyBoxContentPostAreaTableSubjectRowLeftColumn);
    
    		replyBoxContentPostAreaTableSubjectRow.appendChild(replyBoxContentPostAreaTableSubjectRowRightColumn);
    
    		replyBoxContentPostAreaTBody.appendChild(replyBoxContentPostAreaTableSubjectRow);

    Грустно. Очень грустно.

    m1el, 14 Февраля 2010

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

    +109.4

    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
    //Dictionary used to check if eventValues are unique
    Dictionary<string, string> uniqueEventValues = new Dictionary<string, string>();
    
    //... заполняем коллекцию
    
    try {
        uniqueEventValues.Add(eventValue, "X");
    }
    catch (Exception ex) {
        if (ex.Message.Equals("An item with the same key has already been added.")) {
            msgAddEventParams.Text = "EventValues must be unique. " + eventValue + " is duplicate.";
            msgAddEventParams.Visible = true;
            return;
        }
    }

    мы не ищем легких путей!

    Sharp, 09 Февраля 2010

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