1. PHP / Говнокод #2632

    +160.9

    1. 1
    2. 2
    3. 3
    4. 4
    static function &getdbHandler(){
    		global $DB_tree;
    		return $DB_tree;
    }

    Shop-Script поражает....

    metalalisa, 18 Февраля 2010

    Комментарии (9)
  2. JavaScript / Говнокод #2631

    +157.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $('.i18n').each(function() {
    
    	//здесь заменяем для всех i18n на значение поля по умолчанию среди полей его класса
    	$('.' + $(this).attr('id').substr(0, parseInt(($(this).attr('id')).length - <?php echo strlen(c('locale.default')) ?>))).val($('#' + $(this).attr('id').substr(0, parseInt(($(this).attr('id')).length - <?php echo strlen(c('locale.default')) ?>)) + '_<?php echo c('locale.default') ?>').val());
    });

    stereojazz, 18 Февраля 2010

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

    +133.3

    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
    <target name="test-boolean">
    		<condition property="if-true" value="true" else="false">
    			<!-- 
    				Попробуйте попереключайте true / false 
    				и посмотрите на результат - вам однозначно понравится :) 
    			-->
    			<istrue value="false"/>
    		</condition>
    		<antcall target="test-boolean-true"/>
    		<antcall target="test-boolean-false"/>
    	</target>
    	
    	<target name="test-boolean-true" if="if-true">
    		<echo>The condition evaluates to "true"</echo>
    	</target>
    	
    	<target name="test-boolean-false" unless="if-true">
    		<echo>The condition evaluates to "false"</echo>
    	</target>

    Язык - Ant, для тех, кто не в курсе. Я думаю, можно спокойно зачислить в говноязыки.

    wvxvw, 18 Февраля 2010

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

    +168.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    var rus = new String("йцукенгшщзфывапролдячсмитьЙЦУКЕНГШЩЗФЫВАПРОЛДЯЧСМИТЬ");
    var eng = new String("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM");
    for (var i in rus) {
    	reg = new RegExp(rus[i], 'g');
    	pass = pass.replace(reg, eng[i]);
    }

    Конвертация русских чаров в английские в соответствии с расположением на клаве. Зачем - не суть важно. Регулярки! Десятки их! Полсотни итераций для простой замены русских букв на английские!

    ixth, 17 Февраля 2010

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

    +159.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    switch ($_SERVER['QUERY_STRING'])
    {
    case "comments":
                    $content = $_POST['addcomment'] ? $cmt->process_addcomment() : $this->main_comments($_GET['id']);
                break;

    Нашел в очередной cms.

    xynta, 17 Февраля 2010

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

    +108.7

    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
    Function GetFmtTime:String;
    var
      tmpD : string;
      crdate: TDateTime;
    begin
      crdate := Now;
      tmpD := IntToStr(YearOf(crdate))+'-';
    
      If MonthOf(crdate)<10 Then tmpD := tmpD + '0';
      tmpD := tmpD + IntToStr(MonthOf(crdate))+'-';
    
      If DayOf(crdate)<10 Then tmpD := tmpD + '0';
      tmpD := tmpD + IntToStr(DayOf(crdate))+'(';
    
      If HourOf(crdate)<10 Then tmpD := tmpD + '0';
      tmpD := tmpD + IntToStr(HourOf(crdate)) + '-';
    
      If MinuteOf(crdate)<10 Then tmpD := tmpD + '0';
      tmpD := tmpD + IntToStr(MinuteOf(crdate)) + '-';
    
      If SecondOf(crdate)<10 Then tmpD := tmpD + '0';
      tmpD := tmpD + IntToStr(SecondOf(crdate)) + ')';
    
      Result := tmpD;
    end;

    А почему бы не использовать обычную FormatDateTime?!
    До моего прихода на фирму все пользовались выше приведенным кодом! (и много еще чем!)

    Antonio_net, 17 Февраля 2010

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

    +71.6

    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
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.lcdui.Display;
    
    public class BIOS extends MIDlet{
    Kernel kern;
    boolean in=false;
    public void pauseApp(){
    kern.c.println("ACPI :  Macine paused");
    }
    public void destroyApp(boolean b){
    kern.c.println("ACPI : Macine poweroffing");
    exitApp(true);
    }
    public void startApp(){
    if(!in) kern=new Kernel(this);
    else kern.c.println("ACPI : Machine resumed");
    in=true;
    }
    public void exitApp(boolean physical){
    Display.getDisplay(this).setCurrent(kern.c);
    kern.c.println("Changing runlevel to 0... [Ok]");
    kern.c.println("Sending to processes the TERM signal");
    kern.c.println("Sending to processes the KILL signal");
    kern.c.println("Stopping FS: fsdriver");
    kern.fs=null;
    kern.c.println("Sending the system clocktime...");
    try{
    Thread.currentThread().sleep(5000L);kern.c.println("Destroyed.");
    Thread.currentThread().sleep(500L);System.gc();}catch(Exception e){}
    in=false;
    if(physical) notifyDestroyed();
    }
    }

    Очередной кусок говнокода :)

    Pyth_ON, 17 Февраля 2010

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

    +73.3

    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
    package xx.xxxxxxxx.xxx.xxx.gui.constants;
    
    /**
     * constants.
     */
    public class Constants
    {
        public static final int HORIZONTAL_SIZE = 500;
    
        public static final int VERTICAL_SIZE = 340;
    
        public static final int ABS_MAX_LENGTH_NUMBER = 28;
    
        public static final int ZERO = 0;
        public static final int ONE = 1;
        public static final int TWO = 2;
        public static final int THREE = 3;
        public static final int FOUR = 4;
        public static final int FIVE = 5;
    
    }

    ZERO=0, ONE=1, TWO=2, ...
    Ваш К.О.

    xvro, 17 Февраля 2010

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

    +143.8

    1. 1
    News news = new News();

    metaball, 17 Февраля 2010

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

    +162.4

    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
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    $(document).ready(function(){
    $("#dialog-a, #dialog-b, #dialog-c, #dialog-d, #dialog-e, #dialog-f, #dialog-g, #dialog-h, #dialog-i, #dialog-j, #dialog-k, #dialog-l, #dialog-m, #dialog-n, #dialog-o, #dialog-p, #dialog-q, #dialog-r, #dialog-s, #dialog-t, #dialog-u, #dialog-v, #dialog-w, #dialog-x, #dialog-y, #dialog-z").dialog(
    {
    	autoOpen: false,
    	buttons: { 'OK': function() { $(this).dialog("close"); } },
    	modal: true,
    	width: 200
    });
    	$("#button-a-dialog").click(function (event) {
    		$("#dialog-a").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-b-dialog").click(function (event) {
    		$("#dialog-b").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-c-dialog").click(function (event) {
    		$("#dialog-c").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-d-dialog").click(function (event) {
    		$("#dialog-d").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-e-dialog").click(function (event) {
    		$("#dialog-e").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-f-dialog").click(function (event) {
    		$("#dialog-f").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-g-dialog").click(function (event) {
    		$("#dialog-g").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-h-dialog").click(function (event) {
    		$("#dialog-h").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-i-dialog").click(function (event) {
    		$("#dialog-i").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-j-dialog").click(function (event) {
    		$("#dialog-j").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-k-dialog").click(function (event) {
    		$("#dialog-k").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-l-dialog").click(function (event) {
    		$("#dialog-l").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-m-dialog").click(function (event) {
    		$("#dialog-m").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-n-dialog").click(function (event) {
    		$("#dialog-n").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-o-dialog").click(function (event) {
    		$("#dialog-o").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-p-dialog").click(function (event) {
    		$("#dialog-p").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-q-dialog").click(function (event) {
    		$("#dialog-q").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-r-dialog").click(function (event) {
    		$("#dialog-r").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-s-dialog").click(function (event) {
    		$("#dialog-s").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-t-dialog").click(function (event) {
    		$("#dialog-t").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-u-dialog").click(function (event) {
    		$("#dialog-u").dialog('open');
    		event.preventDefault();
    	});
    	$("#button-v-dialog").click(function (event) {
    		$("#dialog-v").dialog('open');

    pasha, 16 Февраля 2010

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