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

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

    +126

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    rename-wiki:
    	$(shell cd ${WIKIDST} && rename 'i-iterate' 'Iterate' *.wiki)
    	$(shell find ${WIKIDST} -name "*.wiki" -exec \
    sed -i 's/\[i-iterate/\[Iterate/g' '{}' \;)
    	$(shell find ${WIKIDST} -name "*.wiki" -exec \
    sed -i 's/\.html\#/\#/g' '{}' \;)
    	$(shell find ${WIKIDST} -name "*.wiki" -exec \
    sed -i 's/&lt;/\</g' '{}' \;)
    	$(shell find ${WIKIDST} -name "*.wiki" -exec \
    sed -i 's/&gt;/\>/g' '{}' \;)

    Чтоль порадовать вас чем-нибудь?

    wvxvw, 12 Декабря 2012

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

    +141

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if(is_dir('install')|| is_dir('migrate')) {
            if (!file_exists(PATH.'/includes/config.inc.php')){
                header('location:/install/');
    			die();
            } else {
                include(PATH.'/core/messages/installation.html');
                die();
            }
        }

    Govnisti_Diavol, 10 Декабря 2012

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

    +109

    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
    string New_naim = E.Remove(0, (NameGR(E.Trim()).Length)).Trim() + " " + Na;
                                    New_naim = New_naim.Trim();
                                    string check_naim =
                                        (E+Na).ToUpper().Replace(" ", "").Replace(",", ".").Replace("-", "").Replace("Е", "E")
                                        .Replace(";", "").Replace("*", "").Replace("Х", "X").Replace("О", "O").Replace("А", "A")
                                        .Replace("В", "B").Replace("М", "M").Replace("Н", "H").Replace("С", "C").Replace("Т", "T").Replace("З", "3")
                                        .Replace("Р", "P").Replace("Q", "G").Replace("К", "K").Replace("О", "O").Replace("0", "O").Replace("%", "").Replace("И", "U");
                                    string check_gosttu = GU.ToUpper().Replace(" ", "").Replace(",", ".").Replace("Е", "E").Replace(".", "")
                                        .Replace("З", "3").Replace(";", "").Replace("*", "").Replace("Х", "X").Replace("О", "O").Replace("А", "A")
                                        .Replace("И", "U").Replace("В", "B").Replace("М", "M").Replace("Н", "H").Replace("С", "C").Replace("Т", "T").Replace("-", "")
                                        .Replace("Р", "P").Replace("Q", "G").Replace("К", "K").Replace("О", "O").Replace("0", "O").Replace("+", "");
                                    /*quer = "SELECT PIN From dbo.Tb_Element Where (Id = '" + Id_el + "') AND "+
                                        "replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(UPPER(GOSTTU)" +
                                        ",' ',''),',','.') ,'Е','E'),'Х','X'),'Т','T'),'К','K'),'О','O'),';',''),'*',''),'А','A'),'В','B'),'М','M'),'Н','H'),'С','C'),'Р','P'),'Q','G'),'О','O'),'0','O'),'.','') = '"+ check_gosttu+   
                                        "' AND replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(UPPER(naim)" +
                                        ",' ',''),',','.') ,'Е','E'),'-',''),'Х','X'),'Т','T'),'К','K'),'О','O'),';',''),'*',''),'А','A'),'В','B'),'М','M'),'Н','H'),'С','C'),'Р','P'),'Q','G'),'О','O'),'0','O') = '" + check_naim + "'";*/
                                    quer = "SELECT e.PIN From dbo.Tb_Element e, dbo.tb_elementname n Where e.id = n.id AND "+
                                        "replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(UPPER(GOSTTU)" +
                                        ",' ',''),',','.') ,'Е','E'),'Х','X'),'Т','T'),'К','K'),'О','O'),';',''),'*',''),'А','A'),'В','B'),'М','M'),'Н','H'),'С','C'),'Р','P'),'Q','G'),'О','O'),'0','O'),'.',''),'И','U'),'З','3'),'+',''),'-','') = '" + check_gosttu +
                                        "' AND replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(UPPER(LTRIM(RTRIM(n.element))+RTRIM(LTRIM(e.naim)))" +
                                        ",' ',''),',','.') ,'Е','E'),'-',''),'Х','X'),'Т','T'),'К','K'),'О','O'),';',''),'*',''),'А','A'),'В','B'),'М','M'),'Н','H'),'С','C'),'Р','P'),'Q','G'),'О','O'),'0','O'),'%',''),'З','3'),'И','U') = '" + check_naim + "'";

    Читаю старый код и радуюсь, что больше с ним не работаю. Правим результаты кривых рук операторов, заводящих данные.

    Grover, 04 Декабря 2012

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

    +121

    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
    This awesome yet simple and pragmatic PHP library performs an addition of two numbers.
    
    In early stages of Internet, developers were forced to work with poor, dry, functional, horrific languages. Everything had to be done through austere functions and operators. There was no objects. No interfaces. No dependency injection.
    
    For example, to make something as simple as an addition, our dads had to write: 1+1. Yeah, really.
    
    Hopefuly now, we have PHP 5.3 and its solid OOP implementation. SimplePHPEasyPlus lets you make this addition in a more fashionable way, using real OOP. It is fast, simple, flexible and tested. To add 1 to 1, all you have to do is:
    
    use SimplePHPEasyPlus\Number\NumberCollection;
    use SimplePHPEasyPlus\Number\SimpleNumber;
    use SimplePHPEasyPlus\Number\CollectionItemNumberProxy;
    use SimplePHPEasyPlus\Parser\SimpleNumberStringParser;
    use SimplePHPEasyPlus\Iterator\CallbackIterator;
    use SimplePHPEasyPlus\Operator\AdditionOperator;
    use SimplePHPEasyPlus\Operation\ArithmeticOperation;
    use SimplePHPEasyPlus\Operation\OperationStream;
    use SimplePHPEasyPlus\Engine;
    use SimplePHPEasyPlus\Calcul\Calcul;
    use SimplePHPEasyPlus\Calcul\CalculRunner;
    
    
    $numberCollection = new NumberCollection();
    
    $numberParser = new SimpleNumberStringParser();
    
    $firstParsedNumber = $numberParser->parse('1');
    $firstNumber = new SimpleNumber($firstParsedNumber);
    $firstNumberProxy = new CollectionItemNumberProxy($firstNumber);
    
    $numberCollection->add($firstNumberProxy);
    
    $secondParsedNumber = $numberParser->parse('1');
    $secondNumber = new SimpleNumber($secondParsedNumber);
    $secondNumberProxy = new CollectionItemNumberProxy($secondNumber);
    
    $numberCollection->add($secondNumberProxy);
    
    $addition = new AdditionOperator('SimplePHPEasyPlus\Number\SimpleNumber');
    
    $operation = new ArithmeticOperation($addition);
    
    $engine = new Engine($operation);
    
    $calcul = new Calcul($engine, $numberCollection);
    
    $runner = new CalculRunner();
    
    $runner->run($calcul);
    
    $result = $calcul->getResult();
    $numericResult = $result->getValue(); // 2
    This library is now available for production purposes. Enjoy!

    [КО]Складывает 2 числа[/КО]

    Vasiliy, 01 Декабря 2012

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

    −91

    1. 1
    2. 2
    // synthesize viewController
    @synthesize viewController;

    Никогда еще комментарии не были столь информативны.

    tirinox, 22 Ноября 2012

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

    −101

    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
    - (void) setSavedData:(NSMutableDictionary *) chordsSettings
    {
    	if ([chordsSettings count]) 
        {
    		currentVariationsIndex = [[chordsSettings valueForKey:@"currentVariationsIndex"] intValue];
            pickerComponent0Row = [[chordsSettings valueForKey:@"pickerComponent0Row"] intValue];
            pickerComponent1Row = [[chordsSettings valueForKey:@"pickerComponent1Row"] intValue];
            canPlayString1 = [[chordsSettings valueForKey:@"canPlayString1"] boolValue];
            canPlayString2 = [[chordsSettings valueForKey:@"canPlayString2"] boolValue];
            canPlayString3 = [[chordsSettings valueForKey:@"canPlayString3"] boolValue];
            canPlayString4 = [[chordsSettings valueForKey:@"canPlayString4"] boolValue];
            canPlayString5 = [[chordsSettings valueForKey:@"canPlayString5"] boolValue];
            canPlayString6 = [[chordsSettings valueForKey:@"canPlayString6"] boolValue];
            lockedString1 = [[chordsSettings valueForKey:@"lockedString1"] boolValue];
            lockedString2 = [[chordsSettings valueForKey:@"lockedString2"] boolValue];
            lockedString3 = [[chordsSettings valueForKey:@"lockedString3"] boolValue];
            lockedString4 = [[chordsSettings valueForKey:@"lockedString4"] boolValue];
            lockedString5 = [[chordsSettings valueForKey:@"lockedString5"] boolValue];
            lockedString6 = [[chordsSettings valueForKey:@"lockedString6"] boolValue];
            chordPartOne = [[chordsSettings valueForKey:@"chordPart1"] retain];
            chordPartTwo = [[chordsSettings valueForKey:@"chordPart2"] retain];
    		flag = [[chordsSettings objectForKey:@"notes"] boolValue];
    	}
        else
        {
        	canPlayString1 = canPlayString2 = canPlayString3 = canPlayString4 = canPlayString5 = canPlayString6 = YES;
        	lockedString1 = lockedString2 = lockedString3 = lockedString4 = lockedString5 = lockedString6 = NO;
        	pickerComponent0Row = pickerComponent1Row = 0;
        	currentVariationsIndex = 0;
    		chordPartOne = @"C";
    		chordPartTwo = @"";
    		flag = NO;
    	}
    	chordPartThree = @"";
    }

    Интересно, если б аффтару нужно было писать приложение не для 6-струнной гитары, а для 12-струнной гитары или даже для арфы, он бы и там упорно не использовал массивы?

    QuickNick, 21 Ноября 2012

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

    +112

    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
    switch (materialType.MaterialClass)
    {
        case 1:
            xtraTabControl1.SelectedTabPageIndex = 0;
            gridView1.Focus();
            eanSimpleButton.Enabled = true;
            break;
        case 2:
            xtraTabControl1.SelectedTabPageIndex = 1;
            gridView2.Focus();
            eanSimpleButton.Enabled = false;
            break;
        case 3:
            xtraTabControl1.SelectedTabPageIndex = 3;
            gridView4.Focus();
            eanSimpleButton.Enabled = false;
            break;
        default:
            xtraTabControl1.SelectedTabPageIndex = 2;
            gridView3.Focus();
            eanSimpleButton.Enabled = false;
            break;
    }

    Стандартный такой быдло-производственный код.

    В зависимости от магического числа в БД, в поле material_class, показывается один из четырёх гридов. При этом в реальной базе класса 3 вообще нет - это поле принимает значения 1, 2 и NULL.

    someone, 21 Ноября 2012

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

    −90

    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
    # -*- coding: utf-8 -*-
    
    i=raw_input('Input number')
    variants={1:lambda :'It`s even',
              2:lambda :'It`s odd',}
    def get_last_digit(i):
        str_digit=str(i)
        return int(str_digit[-1])
    def get_division_2_modulo(i):
        temp=float(i)/2
        str_temp=str(temp)
        str_temp=str_temp.rstrip('.0')
        
        lst_temp=str_temp.split('.')
        
        return len(lst_temp)
    print variants[get_division_2_modulo(get_last_digit(i))]()

    Задание: Напишите программу определения четности / нечетности числа, значение которого вводится с клавиатуры.
    В ответ автор получил такой вот код :)

    Scr1pt1k, 14 Ноября 2012

    Комментарии (8)
  10. Куча / Говнокод #12119

    +128

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    right_triangles = [ (a, b, c a b) | b <- [1..], a <- [1..b], isRight a b ]
    	where
    		rc a b = sqrt $ fromIntegral (a^2 + b^2)
    		c a b = round $ rc a b
    		isRight a b = (rc a b) == fromIntegral (c a b)

    Fai, 14 Ноября 2012

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

    +142

    1. 1
    require_once __DIR__ . '/composer' . '/autoload_real.php';

    Symfony 2

    prodigy, 07 Ноября 2012

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