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

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

    +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
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    function time(){
    var vr=new Date();
    var hour=vr.getHours();
    var min=vr.getMinutes();
    var sec=vr.getSeconds();
    if (sec<=9) {
     if (min<=9) {
      if (hour<=9) {
          document.forms[0].elements[0].value = "0" + hour +":"+ "0" + min +":"+ "0" + sec;
      }
      else {
          document.forms[0].elements[0].value = hour +":"+ "0" + min +":"+ "0" + sec;
      }
     }
     else {
       if (hour<=9) {
          document.forms[0].elements[0].value = "0" + hour +":"+ min +":"+ "0" + sec;
       }
       else {
          document.forms[0].elements[0].value = hour +":"+ min +":"+ "0" + sec;
       }
     }
    }
    else {
     if (min<=9) {
      if (hour<=9) {
         document.forms[0].elements[0].value = "0" + hour +":"+ "0" + min +":"+ sec;
      }
      else {
         document.forms[0].elements[0].value = hour +":"+ "0" + min +":"+ sec;
      }
     }
     else {
      if (hour<=9) {
         document.forms[0].elements[0].value =  "0" + hour +":"+ min +":"+ sec;
      }
      else {
         document.forms[0].elements[0].value = hour +":"+ min +":"+ sec;
      }
     }
    }
    setTimeout("time()",1000);
    }

    Вот такой вот toString().

    yamamoto, 23 Января 2015

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

    +156

    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
    public function fillRow($row, $table)
    {
        static $counter;
        global $app_list_strings, $locale;
    
        $counter++;
        $row['counter'] = $counter;
        $row['status_abc_current'] = $row['status_abc_current'];
        $row['status_abc_1_quarter_ago'] = $row['status_abc_1_quarter_ago'];
        $row['status_abc_2_quarter_ago'] = $row['status_abc_2_quarter_ago'];
        $row['status_abc_3_quarter_ago'] = $row['status_abc_3_quarter_ago'];
        $row['status_abc_4_quarter_ago'] = $row['status_abc_4_quarter_ago'];
    
        return $row;
    }

    что-то тут не так

    mr-lekafe, 22 Января 2015

    Комментарии (4)
  4. Си / Говнокод #17476

    +134

    1. 1
    2. 2
    if (channel->leftover < 0)		// if nothing left over for next time:
    	printk("ERRRRRRRRRRRRRRRRRRRRRRRRRRRR\n");

    RRRRRRRRRRRRRRetard.

    codemonkey, 19 Января 2015

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

    +73

    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
    if (K_fire && select == 1 || K_rightbutton && select == 1) {
        GAME_MODE = 9;
        K_fire = false;
        K_rightbutton = false;
        select = 1;
    }
    if (K_fire && select == 2 || K_rightbutton && select == 2) {
        GAME_MODE = 11;
        FistPaint = true;
        K_fire = false;
        K_rightbutton = false;
        select = 1;
    }
    if (K_fire && select == 3 || K_rightbutton && select == 3) {
        GAME_MODE = 8;
        K_fire = false;
        K_rightbutton = false;
        select = 1;
    }
    if (K_fire && select == 4 || K_rightbutton && select == 4) {
        GAME_MODE = 12;
        FistPaint = true;
        K_fire = false;
        K_rightbutton = false;
        select = 1;
    }
    if (K_fire && select == 5 || K_rightbutton && select == 5) {
        GAME_MODE = 13;
        K_fire = false;
        K_rightbutton = false;
    }
    if (K_leftbutton) {
        GAME_MODE = 13;
        K_leftbutton = false;
    }

    Обработка выбора пункта в главном меню какой-то игры на java me

    xamgore, 14 Января 2015

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

    +161

    1. 1
    2. 2
    3. 3
    if (($arrRoleInHold = $this->syncByToken($token)) && (!$arrRoleInHold)) {
        throw new Exception('');
    }

    хорошее условие!

    tempfolder, 12 Января 2015

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

    +156

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (!!window.Worker){
        var worker = new Worker('worker.js');
        worker.postMessage('Hellow World');
        worker.onmessage = function (e){
          alert(e.data);
        };
      }

    Из статьи на швабре: /post/132785/

    kingmonstr, 05 Января 2015

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

    +107

    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
    var a : int64;
     
    begin
      assign(input, 'input.txt'); reset(input);
      assign(output, 'output.txt'); rewrite(output);
      read(a);
      if a=25 then write ('2.7182818284590452353602875');
      if a=24 then write ('2.718281828459045235360288');
      if a=23 then write ('2.71828182845904523536029');
      if a=22 then write ('2.7182818284590452353603');
      if a=21 then write ('2.718281828459045235360');
      if a=20 then write ('2.71828182845904523536');
      if a=19 then write ('2.7182818284590452354');
      if a=18 then write ('2.718281828459045235');
      if a=17 then write ('2.71828182845904524');
      if a=16 then write ('2.7182818284590452');
      if a=15 then write ('2.718281828459045');
      if a=14 then write ('2.71828182845905');
      if a=13 then write ('2.7182818284590');
      if a=12 then write ('2.718281828459');
      if a=11 then write ('2.71828182846');
      if a=10 then write ('2.7182818285');
      if a=9 then write ('2.718281828');
      if a=8 then write ('2.71828183');
      if a=7 then write ('2.7182818');
      if a=6 then write ('2.718282');
      if a=5 then write ('2.71828');
      if a=4 then write ('2.7183');
      if a=3 then write ('2.718');
      if a=2 then write ('2.72');
      if a=1 then write ('2.7');
      if a=0 then write ('3') 
    end.

    Вывод числа e с заданной точностью

    AndreyZ, 04 Января 2015

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

    +135

    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
    /// <summary>
    /// Converts to number.
    /// </summary>
    /// <param name="value">The value.</param>
    /// <returns>System.String.</returns>
    public static string convertToNumber(string value) {
        string mvalue = "0";
        string wildchars = @"~!@#$%^&*()_+={}[]|\/?><,`:;'";
        bool chknegative = false;
    	if (value == null)
    		value = "";
        try {
            if (value == "") {
                mvalue = "0";
            }
            for (var i = 0; i < wildchars.Length; i++) {
                string wildchar = wildchars.Substring(i, 1);
                //chknegative = value.Contains(wildchar);
                mvalue = value.Replace(wildchar, "");
                value = mvalue;
            }
    
    
            chknegative = value.Contains("-");
    
            if (chknegative) {
                mvalue = value.Replace("-", "");
                mvalue = "-" + mvalue;
            }
            else {
                mvalue = value;
            }
        }
        catch {
            mvalue = "0";
        }
        return mvalue;
    }

    barsv, 29 Декабря 2014

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

    −404

    1. 1
    UIImageView *footerWhite1PxLineThatOnlyAndersWillNotice = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sidebar_line_white"]];

    ох уж этот Андерс!

    besprincypniycentner, 23 Декабря 2014

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

    +155

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    express_static = express.static(static_files.file_path)
        app.use('/files', (req, res, next) ->
            if Math.random() > app.failureProbability
                express_static.handle(req, res, next)
            else
                # server failure or timeout
                if Math.random() < 0.5
                    console.log('\x1B[31mRandom failure\x1B[0m')
                    res.send(500, 'Fuck you')
                else
                    console.log('\x1B[31mRandom timeout\x1B[0m')
        )

    а вот так мы тестируем сетевую нагрузку (нода, кофе)

    makc3d, 21 Декабря 2014

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