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

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

    +156

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if ($('#stoykaKS').is(':checked')) /*     29             */
    {wt.document.writeln('<div style=" position: absolute; top: 0; left: 0;"><img src="../images/stories/esd-classic/picstoykaKS.gif" /></div>');}
    if ($('#stolUS01').is(':checked')) /*      8             */
    {wt.document.writeln('<div style=" position: absolute; top: 0; left: 0;"><img src="../images/stories/esd-classic/picstolUS01.gif" /></div>');}
    if ($('#perfoPFPX').is(':checked')) /*    21              */
    {wt.document.writeln('<div style=" position: absolute; top: 0; left: 0;"><img src="../images/stories/esd-classic/picperfoPFPX.gif" /></div>');}

    И так далее, несколько сотен строк.

    Tairesh, 20 Июля 2012

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

    +151

    1. 1
    2. 2
    3. 3
    4. 4
    if(typeof console == 'object' && typeof console.log == 'function'){
        log = console.log.bind(console);
    }
    else log = function(attr){}

    хуита, 19 Июля 2012

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

    +68

    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
    public function makeCategoryArray() {
            $a = array();
            for($i = 1; $i <=3 ; $i++) {
                $j = $i != 1 ? $i : '';
                $Method = "getCategoryid" . $j;
                $categoryid = $this->$Method();
                if($this->$Method()) {
                    try{
                        $category = BC::Get()->getCompanyService()->getCategoryByID($categoryid);
                        $a[] = array(
                            'name' => $category->getName(),
                            'url' => $category->makeURL()
                        );
                    } catch(Exception $e) {
                        return $a;
                    }
                }
            }
            return $a;
        }

    Эпичный вызов getCategoryid1(), getCategoryid2(), getCategoryid3() когда есть getField(fieldname)...

    max_wp, 13 Июля 2012

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

    +134

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    for (int i = 0; i < e.Row.Cells.Count; i++)
                        {
                            ....................................................
                            if ((i == 1) || (i == 4) || (i == 5) || (i == 6) || (i == 7) || (i == 8) || (i == 9) || (i == 10) || (i == 11) || (i == 12))//11 12
    .............................................

    Indian style..
    no comments

    Nataly, 12 Июля 2012

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

    +61

    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
    function myrnd(){
    	$rnd1=rand(48,57);
    	$rnd2=rand(65,90);
    	$rnd3=rand(97,122);
    	$rnd4=rand(1,3);
    	$rnd5="rnd".$rnd4;
    	return $$rnd5;
    }
    function createReffererLink(){
    	$refferer="";
    	for($i=0;$i<12;$i++){
    		$refferer.=chr($this->myrnd());
    	}
    	return $refferer;
    }

    Нашел в своей старой партнерской программе. Угадайте, что делает этот код? ( генерирует реферальную ссылку )

    xcont, 07 Июля 2012

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

    +99

    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
    program lab;
    usescrt
    var
    a:array [1..20] of shortint;
    s:byte;
    g,b:real;
    begin
    clrscr
    randomize;
    for s:=1 to 20 do 	
    begin 
    a[s]:=random (40);
    a[s]:=a[s]-20;
    write (a [s]4);
    end;
    g:=0
    for s:=1 to 20 do
    if a[s]>0 , then g= g+a [s];
    writelnc(summa pol ',g);
    b:=0;
    for s:=1 to 20 do
    if a[s]<0 then b:=b+a[s];
    writeln (srednee',b);
    b:=(b)/20;
    repeat until keypressed;
    end.

    http://rghost.ru/38741341

    dos_, 01 Июля 2012

    Комментарии (8)
  8. Assembler / Говнокод #11313

    +199

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    sum proc ; ax=ax+bx
            push dx
    m1:     mov dx, ax
            xor ax, bx
            and bx, dx
            shl bx, 01h
            cmp bx, 00h
            jnz m1
            pop dx
            ret
    sum endp

    Навеяно http://govnokod.ru/11311

    movaxbx, 28 Июня 2012

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

    +45

    1. 1
    $ApsolutePath = $_SERVER['DOCUMENT_ROOT']; # Абсолютный путь до сайта (автоматическое определение корневой директории)

    $ApsolutePath - Ну как? КАК?

    domaster, 22 Июня 2012

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

    −36

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    //установка режима реализма
    		void includeRealTimeMode()
    		{
    			TSerialCommand^ command = gcnew TSerialCommand;
    			command->cmd = CMD_CONTROL;
    			command->sc1 = SC_REAL_TIME_MODE;
    			command->sc2 = NULL; //_portManager.oscillFrequency;
    			_portManager.sendCommand(command);
    
    		}

    Команда включает (активирует) режим реального времени.
    C++\CLI

    Говногость, 19 Июня 2012

    Комментарии (8)
  11. ActionScript / Говнокод #11229

    −167

    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
    public function getFiltersDescription () : IList
    {
    	var model : ITableBasedModuleModel = this.getTableBasedModel();
    	return model.filtersDescription;
    }
    
    public function getModuleTitle () : String
    {
    	var model : ITableBasedModuleModel = this.getTableBasedModel();
    	return model.getTitle();
    }
    
    //....
    private function getTableBasedModel () : ITableBasedModuleModel
    {
    	return this.model as ITableBasedModuleModel;
    }
    
    private function getTableBasedView () : ITableBasedModuleView
    {
    	return this.view as ITableBasedModuleView;
    }

    Java ооп головного мозга.

    kyzi007, 19 Июня 2012

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