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

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

    +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
    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
    public function actionNominate()
    	{
    		if (isset($_POST['user']) and isset($_POST['ref']))
    		{
    
    			$user = $ref = NULL;
    			$user = strip_tags(trim($_POST['user']));
    			$ref = strip_tags(trim($_POST['ref']));
    
    			$test = UserAwardsRef::model()->count(array("condition"=>"id_ref=$ref AND id_user=$user"));
    
    			if ($test==0)
    			{
    				if ($user and $ref)
    				{
    					$model = new UserAwardsRef();
    					$model->id_ref = $ref;
    					$model->id_user = $user;
    					if ($model->save())
    					{
    						echo 1;
    					} else {
    						echo 'error';
    					}
                    } else {
    
    					echo "error";
    				}
    
    			} else {
    				echo 2;
    			}
    
    		} else {
    
    			echo "error";
    		}
    
    	}

    Входящие параметры предполагаются - integer
    Необходимо один раз насрать в таблицу с ключами из поста.

    obidnov, 16 Января 2015

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

    +133

    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
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace nonopt
    {
        class Program
        {
            static void Main(string[] args)
            {
                string h = "h";
                string e = "e";
                string l1 = "l";
                string l2 = "l";
                string o1 = "o";
                string he = h + e;
    			string ll = l1 + l2;
                string hell = he + ll;
                string hello = hell + o1;
                string w = "w";
                string o2 = "o";
                string r = "r";
                string l3 = "l";
                string d = "d";
                string wo = w + o2;
                string rl = r + l3;
                string worl = wo + rl;
                string world = worl + d;
                string empty = " ";
                Console.WriteLine(hello + empty + world);
    			Console.ReadKey();
            }
        }
    }

    pewppy, 10 Января 2015

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

    +157

    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
    $('.file_work .left .content a.create').bind('click', function(){
            show.in_question(strings.question[2], {
                0:strings.question[2].buttons[0], 
                1:strings.question[2].buttons[1]
            }, function(action, string){
                if(action !='ok'){
                    return;
                }
                if(string.length<4){
                    show.error(strings.error[7], '');
                    return;
                }
                CreateTag(cache.current, string);
            });
        });

    хуита, 22 Декабря 2014

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

    +58

    1. 1
    int (o)(0);

    http://ideone.com/9JL6K4

    bormand, 22 Декабря 2014

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

    −107

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    ****@****:~$ python
    >>> import this
    The Zen of Python, by Tim Peters
    <....>There should be one-- and preferably only one --obvious way to do it.<...>
    >>> exit
    Use exit() or Ctrl-D (i.e. EOF) to exit

    preferably only one

    heyzea1, 19 Декабря 2014

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

    +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
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    <?php
    foreach ($details->result_array() as $row) {
        $name = $row['name'];
        $email = $row['email'];
        $avatar = $row['avatar'];
        $access = $row['access'];
        $notify = $row['notify'];
        $notifysms = $row['notifysms'];
        $mobile = $row['mobile'];
        $signature = $row['signature'];
    
        $address = $row['address'];
        $city = $row['city'];
        $state = $row['state'];
        $zip = $row['zip'];
        $country = $row['country'];
        $phone = $row['phone'];
        $mobile = $row['mobile'];
        
        $external_state = $row['external_state'];
        $external_auth = $row['external_auth'];
    }
    ?>

    Убивает к тому же то, что этот кусок написан в файле представления. Еще спрашивают, почему я решил уволиться :)

    omegascorp, 19 Декабря 2014

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

    +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
    static void InitializeRegExGrammar()
            {
                SimpleRegExGrammar[0] = "A->B";
                SimpleRegExGrammar[1] = "A->B|A";
                SimpleRegExGrammar[2] = "B->C";
                SimpleRegExGrammar[3] = "B->C@B";
                SimpleRegExGrammar[4] = "C->D*";
                SimpleRegExGrammar[5] = "C->D";
                SimpleRegExGrammar[6] = "D->(A)";
                SimpleRegExGrammar[7] = "D->a";
                SimpleRegExGrammar[8] = "D->b";
                SimpleRegExGrammar[9] = "D->c";
                SimpleRegExGrammar[10] = "D->d";
                SimpleRegExGrammar[11] = "D->e";
                SimpleRegExGrammar[12] = "D->f";
                SimpleRegExGrammar[13] = "D->g";
                SimpleRegExGrammar[14] = "D->h";
                SimpleRegExGrammar[15] = "D->i";
                SimpleRegExGrammar[16] = "D->j";
                SimpleRegExGrammar[17] = "D->k";
                SimpleRegExGrammar[18] = "D->l";
                SimpleRegExGrammar[19] = "D->m";
                SimpleRegExGrammar[20] = "D->n";
                SimpleRegExGrammar[21] = "D->o";
                SimpleRegExGrammar[22] = "D->p";
                SimpleRegExGrammar[23] = "D->q";
                SimpleRegExGrammar[24] = "D->r";
                SimpleRegExGrammar[25] = "D->s";
                SimpleRegExGrammar[26] = "D->t";
                SimpleRegExGrammar[27] = "D->u";
                SimpleRegExGrammar[28] = "D->v";
                SimpleRegExGrammar[29] = "D->w";
                SimpleRegExGrammar[30] = "D->x";
                SimpleRegExGrammar[31] = "D->y";
                SimpleRegExGrammar[32] = "D->z";
            }

    Пока отправлял, придумал, как лучше сделать =(

    Destiner, 14 Декабря 2014

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

    −126

    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
    Попытка
            ЭлементыФормы[Надпись].Картинка = БиблиотекаКартинок.ЗначокОбработкаВПанелиФункций16
    Исключение
            Попытка
                    ЭлементыФормы[Надпись].Картинка = БиблиотекаКартинок.Выполнить
            Исключение
                    Попытка
                            ЭлементыФормы[Надпись].Картинка = БиблиотекаКартинок.Сформировать
                    Исключение
                            Попытка
                                    ЭлементыФормы[Надпись].Картинка = БиблиотекаКартинок.ПерейтиНаСледующийЭтапСделки
                            Исключение
                                    Попытка
                                            ЭлементыФормы[Надпись].Картинка = БиблиотекаКартинок.ВыполнитьОбменДаннымиИнтерактивно
                                    Исключение
                                    КонецПопытки
                            КонецПопытки
                    КонецПопытки
            КонецПопытки
    КонецПопытки;

    Отака хуєта розкидана в одній і тій самій обробці в кількох місцях

    monstrodev, 27 Ноября 2014

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

    +155

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    function in_array(value, array)
    {
        if (is_array(array)){
            for(var i = 0; i < array.length; i++)
            {
                if(array[i] == value) return true;
            }
            return false;
        }
    
    }

    от создателей http://govnokod.ru/17149

    heyzea1, 25 Ноября 2014

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

    +74

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public static void main(String[] args) throws Exception {
        ...
        try {
            Signature.getInstance("NONEwithRSA", "SUN");
            throw new Exception("call succeeded");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        System.out.println("OK");
    }

    http://jdk.openjdk-rt.googlecode.com/hg/test/java/security/Signature/NONEwithRSA.java

    Naturlih, 13 Ноября 2014

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