1. Java / Говнокод #3031

    +73.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
    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
    package psorter;
    
    import java.util.Vector;
    
    public class CArray extends Vector {
        String type="";
    
        /**
         * constructor of /array/
         * @param i set capacity increment
         */
        public CArray(int i) {
    	this.capacityIncrement=i;
        }
    
        /**
         * add object to end of vector with check of type
         * if type same as @ first added - add this object
         * safer than add
         * @param o object to add
         */
        public void append(Object o) {
    	if ( this.type.equals("") )
    	    this.type=o.getClass().toString();
    
    	if ( o.getClass().toString().equals(this.type) ){
    	    this.add(o);
    	} else {
    	    if ( this.type.contains("Float") && o.getClass().toString().contains("Integer") )
    		this.add( Float.valueOf(o.toString()) );
    
    	    if ( this.type.contains("Double") && o.getClass().toString().contains("Integer") )
    		this.add( Double.valueOf(o.toString()) );
    	    if ( this.type.contains("Double") && o.getClass().toString().contains("Float") )
    		this.add( Double.valueOf(o.toString()) );
    
    	    if ( this.type.contains("String") && o.getClass().toString().contains("Char") )
    		this.add( o.toString() );
    	}
        }
    
        public byte compare(int i, int j) throws Exception {
    	if (type.contains("Integer")) {
    	    if ((Integer) (this.get(i)) > (Integer) (this.get(j)))
    		return 1;
    	    if ((Integer) (this.get(i)) < (Integer) (this.get(j)))
    		return -1;
    	    return 0;
    	}
    
    	if (type.contains("Float")) {
    	    if ((Float) (this.get(i)) > (Float) (this.get(j)))
    		return 1;
    	    if ((Float) (this.get(i)) < (Float) (this.get(j)))
    		return -1;
    	    return 0;
    	}
    
    	if (type.contains("Double")) {
    	    if ((Double) (this.get(i)) > (Double) (this.get(j)))
    		return 1;
    	    if ((Double) (this.get(i)) < (Double) (this.get(j)))
    		return -1;
    	    return 0;
    	}
    
    	if (type.contains("Char")) {
    	    if ((Character) (this.get(i)) > (Character) (this.get(j)))
    		return 1;
    	    if ((Character) (this.get(i)) < (Character) (this.get(j)))
    		return -1;
    	    return 0;
    	}
    
    	if (type.contains("String")) {
    	    if ( this.get(i).toString().compareTo(this.get(j).toString())>0 )
    		return 1;
    	    if ( this.get(i).toString().compareTo(this.get(j).toString())<0 )
    		return -1;
    	    return 0;
    	}
    
    	return 0;
        }
    }

    сел писать 3 лабы естественно в последнюю ночь. начал в 11. эта была около 3х. самому потом стыдно было нести такое

    ilardm, 17 Апреля 2010

    Комментарии (15)
  2. C++ / Говнокод #3030

    +901

    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
    char * b = new char[100];
                    int Length = 0;
                    while ( a[++Length] );
                        for ( int i = 0; i<= 10; i++ )
                          {
                                b[i] = a[i];
                          }
    
    
                        for ( int i = 0; i<= Length; i++ )
                          {
                                move ( y, x+i );
                                printw ( "%c", b[i] );
                          }
                     delete b;
                     return;

    вывод строки в ncurses.
    доставляет школота?

    MyParanoya, 17 Апреля 2010

    Комментарии (17)
  3. Ruby / Говнокод #3029

    −100.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    def ordinalize_ru integer
      postfix = case integer
        when 0 then 'ой'
        when 2 then 'ой'
        when 3 then 'ий'
        when 6 then 'ой'
        when 7 then 'ой'
        when 8 then 'ой'
        else 'й'
      end
      [ integer, postfix ].join '-'
    end

    Когда нет времени вникать в правила родного языка и русской речи. Суровый уральский говнокод.

    eveel, 17 Апреля 2010

    Комментарии (22)
  4. Куча / Говнокод #3028

    +78.4

    Анонимус-срач на говнокод.ру

    Мне немногозначно дали понять, что анонимы всех достали. Пишут в почту, в icq, в реформал и даже смски шлют.
    Проект уже вырос из того нежного возраста, когда его судьбу мог решать я сам. Посему предлагаю обсудить сложившуюся ситуацию и прийти к соглашению, выпиливать ли анонимов или оставлять.

    striker, 17 Апреля 2010

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

    +143.8

    1. 1
    foreach ($invoises as $invoiceId => $invoice) {

    Вот так и работаем с инвойсами...

    DiSH, 16 Апреля 2010

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

    +150.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $tttr = rand( 1, 2 );
    if ( $tttr == 1 )
    {
        $bonusik = "&dd=10|";
    }
    if ( $tttr == 2 )
    {
        $bonusik = "&dd=5|dd=5|";
    }

    Random and naming fails.

    Bobby, 16 Апреля 2010

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

    +153.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    $db = new PDO("mysql:host=" . $config['dbhost'] . ";dbname=" . $config['dbname'], $config['dbuser'], $config['dbpassword']);
    $db->exec("set names utf8");
    $result = $db->query("call get_user_account('$session_id');");
    foreach ($result as $row)
    {
        die($row['account']);
    }
    die("err");

    Готический output.

    Bobby, 16 Апреля 2010

    Комментарии (2)
  8. bash / Говнокод #3024

    −138.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    #       sysinfo bar
    while :; do
            echo $(uptime | awk '{ print $3"d, "$5" "$6"u"}') '|' $(free -k | grep "cache:" | awk '{print $3"k / "$4"k"}') '|^fg(#cccc00)' $(date | sed 's,MSD .*,,') "^fg(#bbbbdd)|" $(cat /proc/loadavg | awk '{print $1" "$2" "$3}') '|' $(gcpubar -o -c 1 | sed 's,CPU: ,,')  '            '
            sleep 1
    done | dzen2 -ta r -x $WIDTH -y $Y $COLORS -fn $FONT -e 'button1=exec:mpc toggle;button2=exec:mpc prev;button3=exec:mpc next;button4=exec:mpcvolume +;button5=exec:mpcvolume -' &

    подобных баров с пяток в скрипте, не стал все приводить

    erthad, 16 Апреля 2010

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

    +56.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    interfaceSprites[0]=new hgeSprite(interfaceSet,32,0,10,10);
        interfaceSprites[1]=new hgeSprite(interfaceSet,42,0,10,10);
        interfaceSprites[2]=new hgeSprite(interfaceSet,52,0,10,10);
        interfaceSprites[3]=new hgeSprite(interfaceSet,32,10,10,10);
        interfaceSprites[4]=new hgeSprite(interfaceSet,42,10,10,10);
        interfaceSprites[5]=new hgeSprite(interfaceSet,52,10,10,10);
        interfaceSprites[6]=new hgeSprite(interfaceSet,32,20,10,10);
        interfaceSprites[7]=new hgeSprite(interfaceSet,42,20,10,10);
        interfaceSprites[8]=new hgeSprite(interfaceSet,52,20,10,10);

    весело, что это более читабельно, чем с циклом...

    MyParanoya, 16 Апреля 2010

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

    +61.2

    1. 1
    2. 2
    3. 3
    4. 4
    FILE *f=fopen(name, "wb");
    char *text="<DMB 1.0>\n\n";
    for(int i=0;i<=10;i++){fputc((int)text, f);}
    fclose(f);

    Замечу это c++, так как это чудо находилось в классе.

    hromjo, 16 Апреля 2010

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