1. Python / Говнокод #15818

    −98

    1. 1
    2. 2
    3. 3
    4. 4
    if value is False:
        res = ~res
    elif not value is True:
        raise AnalyzeError("Invalid value {0}".format(condition.value))

    hugr, 22 Апреля 2014

    Комментарии (3)
  2. Pascal / Говнокод #15815

    +80

    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
    Procedure ChangeDataBase(var phone:cellphone);
    var ch:char;
    
    Begin clrscr;
    With Phone do
              Begin Line;
    	  TextColor(Cyan); Writeln(' Выберите тип аппарата: '); TextColor(White);
    	  Writeln(' [0-Телефон | 1-Смартфон]');
    
    	  Repeat
    	  Ch:=Readkey;
    	  if (Ch in [#48,#49]) then
    	                                            Begin
    	                                            if (Ch = #48) then Types:=('Телефон');
    	                                            if (Ch = #49) then Types:=('Смартфон');
    	                                            end
    	                                     else
    	                                            Begin
    	                                            TextColor(Red); Writeln(' ОШИБКА: Неверный диапазон! Повторите ввод...')
    	                                            end;
              Until (Ch in [#48,#49]);
    
              TextColor(Cyan); Write(' Тип аппарата: ');TextColor(Yellow); Writeln(Types); Line;
              TextColor(Cyan); Write(' Производитель: '); TextColor(Yellow); Readln(Maker);
              TextColor(Cyan); Write(' Модель: '); TextColor(Yellow); Readln(Model);
              Line;
    
              TextColor(Cyan); Writeln(' Выберите тип корпуса: '); TextColor(White);
              Writeln(' [0-Классический | 1-Раскладной | 2-Слайдер]');
              
              Repeat
              Ch:=Readkey;
              if (Ch in [#48..#50]) then
    	                                              Begin
    	                                              if (Ch = #48) then Body:=('Классический');
    	                                              if (Ch = #49) then Body:=('Раскладной');
    	                                              if (Ch = #50) then Body:=('Слайдер');
    	                                              end
    		                              else
    	                                              Begin
    	                                              TextColor(Red); Writeln(' ОШИБКА: Неверный диапазон! Повторите ввод...')
    	                                              end;
              Until (Ch in [#48..#50]);
    
              TextColor(Cyan); Write(' Тип корпуса: ');TextColor(Yellow); Writeln(Body); Line;
    
              TextColor(Cyan); Writeln(' Выберите операционную систему: '); TextColor(White);
              Writeln(' [0-Asha | 1-Android | 2-Bada OS | 3-iOS | 4-Symbian ]');
    	  Writeln(' [5-Windows Phone 7 | 6-Windows Phone 8 | 7-Другая]');
    	 
              Repeat
    	  Ch:=Readkey;
    	  if (Ch in [#48..#55]) then
    	                                              Begin
    	                                              if (Ch = #48) then Os:=('Asha');
    	                                              if (Ch = #49) then Os:=('Android');
    	                                              if (Ch = #50) then Os:=('Bada OS');
    	                                              if (Ch = #51) then Os:=('iOS');
    	                                              if (Ch = #52) then Os:=('Symbian');
    	                                              if (Ch = #53) then Os:=('Windows Phone 7');
    	                                              if (Ch = #54) then Os:=('Windows Phone 8');
    	                                              if (Ch = #55) then Os:=('Другая');
    	                                              end
    		                              else
    	                                              Begin
    	                                              TextColor(Red); Writeln('ОШИБКА: Неверный диапазон! Повторите ввод...')
    	                                              end;
              Until (Ch in [#48..#55]);
              TextColor(Cyan); Write(' Операционная система: ');TextColor(Yellow); Writeln(Os); Line;
    
              TextColor(Cyan); Write(' Цена: '); TextColor(Yellow); Readln(Price);
    end;
    LastGlobalMenu; {Возврат в основное меню}
    end;

    Serjant, 22 Апреля 2014

    Комментарии (0)
  3. Куча / Говнокод #15814

    +127

    1. 1
    https://www.peereboom.us/assl/assl/html/openssl.html

    laMer007, 22 Апреля 2014

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function commerce_auction_dividable($big, $small) {
      $div = $big / $small;
    
      if (!is_numeric(strpos($div, '.')) === TRUE) {
        return TRUE;
      }
      return FALSE;
    }

    https://drupal.org/node/1721568

    Int, 22 Апреля 2014

    Комментарии (37)
  5. JavaScript / Говнокод #15812

    +158

    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
    for (i in rates) {
       if (CheckFlightInRates(FlightStartRate, rates[i]['dirs'][0]['trips'][0]) == 2) {
          if (CheckFlightInRates(FlightSecondRate, rates[i]['dirs'][0]['trips'][1]) != 0) {
             //var flightNmSecond = rates[i]['dirs'][0]['trips'][1]['params']['airCmp']+'-'+rates[i]['dirs'][0]['trips'][1]['params']['fltNm'];
             if (CheckFlightInRates(FlightSecondRate, rates[i]['dirs'][0]['trips'][1]) == 2) {
                if (CheckFlightInRates(FlightThirdRate, rates[i]['dirs'][0]['trips'][2]) != 0) {
                   //var flightNmThird = rates[i]['dirs'][0]['trips'][2]['params']['airCmp']+'-'+rates[i]['dirs'][0]['trips'][2]['params']['fltNm'];
                   if (CheckFlightInRates(FlightThirdRate, rates[i]['dirs'][0]['trips'][2]) == 2) {
                      if (FlightBackStartRate != '') {
                         if (CheckFlightInRates(FlightBackStartRate, rates[i]['dirs'][1]['trips'][0]) == 2) {
                            if (CheckFlightInRates(FlightBackSecondRate, rates[i]['dirs'][1]['trips'][1]) != 0) {
                               //var flightNmSecond = rates[i]['dirs'][0]['trips'][1]['params']['airCmp']+'-'+rates[i]['dirs'][0]['trips'][1]['params']['fltNm'];
                               if (CheckFlightInRates(FlightBackSecondRate, rates[i]['dirs'][1]['trips'][1]) == 2) {
                                  if (CheckFlightInRates(FlightBackThirdRate, rates[i]['dirs'][1]['trips'][2]) != 0) {
                                     //var flightNmThird = rates[i]['dirs'][0]['trips'][2]['params']['airCmp']+'-'+rates[i]['dirs'][0]['trips'][2]['params']['fltNm'];
                                     if (CheckFlightInRates(FlightBackThirdRate, rates[i]['dirs'][1]['trips'][2]) == 2) {
                                        if (rates[i]['price'] != options.values.price) {
                                           FlightMinPrice3.push(rates[i]['price']);
                                           ButtonToPress3[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i
                                        }
                                        else {
                                           FlightMinPrice.push(rates[i]['price']);
                                           ButtonToPress[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i;
                                        }
                                     }
                                  }
                                  else {
                                     if (rates[i]['price'] != options.values.price) {
                                        FlightMinPrice3.push(rates[i]['price']);
                                        ButtonToPress3[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i
                                     }
                                     else {
    
                                        FlightMinPrice.push(rates[i]['price']);
                                        ButtonToPress[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i;
                                     }
                                  }
                               }
                            }
                            else {
                               if (rates[i]['price'] != options.values.price) {
                                  FlightMinPrice3.push(rates[i]['price']);
                                  ButtonToPress3[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i
                               }
                               else {
                                  FlightMinPrice.push(rates[i]['price']);
                                  ButtonToPress[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i
                               }
                            }
                         }
                         else {
                            if (rates[i]['price'] != options.values.price) {
                               FlightMinPrice3.push(rates[i]['price']);
                               ButtonToPress3[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i
                            }
                            else {
                               FlightMinPriceOther2.push(rates[i]['price']);
                               ButtonToPressOther2[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i;
                            }
                         }
                      }
                      else {
                         if (rates[i]['price'] != options.values.price) {
                            FlightMinPrice3.push(rates[i]['price']);
                            ButtonToPress3[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i
                         }
                         else {
                            FlightMinPrice.push(rates[i]['price']);
                            ButtonToPress[rates[i]['price']] = '#fare_' + rates[i]['id'] + '_' + i;
                         }
                      }
    
                   }

    https://www.svyaznoy.travel/avia/styles/js/Flight.js?cache=20140418-1
    весь русский онлайн-тревел такой

    tablecell, 22 Апреля 2014

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

    +153

    1. 1
    print implode('-', array_reverse(explode('-', trim(substr($project->start_date, 0, count($project->start_date) - 9)))));

    Форматирует дату с Y-m-d в d-m-Y. Альтернатива для
    date_format(new DateTime($project->start_date), 'd-m-Y');

    djumpen, 22 Апреля 2014

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

    +70

    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
    {
    	final int p = page;
    	final boolean current = p == 1;
    	this.pagercell(writer, current, 1, "<<");
    }
    for (int p = page - this.size; p < page; p++) {
    	if (p >= 1) {
    		final boolean current = p == 1;
    		this.pagercell(writer, current, p);
    	}
    }
    {
    	final int p = page;
    	final boolean current = (p - this.size) < 1;
    	this.pagercell(writer, current, p - this.size, "<");
    }
    {
    	final int p = page;
    	final boolean current = p == page;
    	this.pagercell(writer, current, p);
    }
    {
    	final int p = page;
    	final boolean current = (p + this.size) > pages;
    	this.pagercell(writer, current, p + this.size, ">");
    }
    for (int p = page + 1; p <= (page + this.size); p++) {
    	if (p <= pages) {
    		final boolean current = p == pages;
    		this.pagercell(writer, current, p);
    	}
    }
    {
    	final int p = page;
    	final boolean current = p == pages;
    	this.pagercell(writer, current, pages, ">>");
    }

    веселый вывод постраничной навигации (кусок метода)

    Lure Of Chaos, 22 Апреля 2014

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

    +64

    1. 1
    short someShort = (short) (someBoolean ? 15 : 42);

    такая удобная Java

    evg_ever, 21 Апреля 2014

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

    +157

    1. 1
    setcookie('password', $passHash , time() + $this::TIME_COOKIE * 1000 +  $remember ? $this::TIME_COOKIE_REMEMBER : 0  * 1000 );

    И я то думал, почему кука не появляется...

    Dart_Sergius, 21 Апреля 2014

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

    +143

    1. 1
    +++++[>++>+++[>+++>+++<<-]>+<<<-]+++[>>>-.<[>>.>+<<+.<-]<.>>+.>>+[<.<-.<+>>>-]<<+<+<.<-]

    Brainfuck, задача - вывести
    1
    2-1
    1-2-3
    4-3-2-1
    1-2-3-4-5
    6-5-4-3-2-1

    Из этой ветки: http://habrahabr.ru/post/116842/#comment_3794462

    gost, 21 Апреля 2014

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