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

    +104.9

    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
    echo “<select id=\”seltel[".$i."]\”>”;
    switch ($data2["PHONE"][$i]["type"]) {
    case “Факс”:
    echo “<option selected>Факс”;
    echo “<option>Офисный телефон”;
    echo “<option>Колцентр”;
    echo “<option>Телефон”;
    echo “<option>Мобильный телефон”;
    break;
    case “Офисный телефон”:
    echo “<option>Факс”;
    echo “<option selected>Офисный телефон”;
    echo “<option>Колцентр”;
    echo “<option>Телефон”;
    echo “<option>Мобильный телефон”;
    break;
    case “Колцентр”:
    echo “<option>Факс”;
    echo “<option>Офисный телефон”;
    echo “<option selected>Колцентр”;
    echo “<option>Телефон”;
    echo “<option>Мобильный телефон”;
    break;
    case “Телефон”:
    echo “<option>Факс”;
    echo “<option>Офисный телефон”;
    echo “<option>Колцентр”;
    echo “<option selected>Телефон”;
    echo “<option>Мобильный телефон”;
    break;
    case “Мобильный телефон”:
    echo “<option>Факс”;
    echo “<option>Офисный телефон”;
    echo “<option>Колцентр”;
    echo “<option>Телефон”;
    echo “<option selected>Мобильный телефон”;
    break;
    };
    echo “</select><br/>”;

    вот как надо создавать выпадающие списки!

    guest, 12 Декабря 2008

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

    +58.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <script>
    var InternetExplorer = navigator.appName.indexOf(«Microsoft») != -1;
    var ie = 0;
    if (InternetExplorer) { var ie=1 }
    </script>

    проверка ИЕ.

    guest, 12 Декабря 2008

    Комментарии (15)
  3. Perl / Говнокод #138

    −379.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
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    sub pfexec { args "pfexec", @_ unless $1.$2 eq "pfexec";
      local ( $_, $lp, @rep ) = @_; $lp ||= 1;
      die 'Command string must not contain $$ sequences' if m/\$\$/o;
      1 while s/\(([^()]*)\)/'$$'.push(@rep,$1)/eo;
    # print $_,"REP:\n","=>",join( "\n=>", @rep),"\n";
      unshift @rep, ""; s/\s+/ /g;
    
    LOOP: while ( $lp-- ) {
            foreach ( split ";" ){
              my @cmd = split " "; $_ = shift @cmd; last unless m/^(\w{2})(\w+)/o;
    CMD:  foreach (@cmd){
                    1 while s/\$\$(\d+)/'('.$rep[$1].')'/eo; s/^\(\s*(.*?)\s*\)$/$1/so;
                    s/^\%(\d+)->(\w+)=//    and ${$HASH[$1]} ->{$2} = $_ and next;
                    /^\%(\d+)->(\w+)/               and $_ = ${$HASH[$1]} ->{$2} and redo CMD;
    
                    /^%%(\d+)/      and $_ = $HASH[$1] || ( $HASH[$1] = \{} ) and next;
                    /^\%(\d+)/      and $_ = ${$HASH[$1]} and next;
                    /^\#\#(\d+)/ and $_ = $CHAN[$1] || ( $CHAN[$1] = \{} ) and next;
                    /^\#(\d+)/      and $_ = ${$CHAN[$1]} and next;
              }
              $_ = $::control{$1} && $::control{$1}{$2};
              s/\^(\d+)/$cmd[$1-1]/geo and print "Expanded to: $_\n"
                    and pfexec( $_ ) if !ref;
              args $1.$2, @cmd and eval { $_->(@cmd) } if "CODE" eq ref;
              last LOOP if $@;
            }
      }

    Так пишет мой коллега

    guest, 12 Декабря 2008

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

    +22.8

    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
    $year=date('y');
    $y=date('Y');
    $month=date('M');
    $day=date('d');
    $dayofmonth=date('D');
    print "Today is $day $month $y, $dayofmonth.";
    
    if($month=="Apr" || $month=="Jun" || $month=="Sep" || $month=="Nov")
    { $maxday=30; }
    else if($month=="Feb") 
    { if($year % 4) { $maxday=28; } else { $maxday=29; } }
    else 
    { $maxday=31; }
    
    #print "Current month consist of $maxday days.\n";
    
    #Для высокосных годов
    
    if($year=="04" || $year=="32" | $year=="60" || $year=="88")
    { if($month=="Jan" || $month=="Apr" || $month=="Jul")
      { $fd=4; }
      else if($month=="Feb" || $month=="Avg")
      { $fd=0; }
      else if($month=="Mar" || $month=="Nov")
      { $fd=1; }
      else if($month=="May")
      { $fd=6; }
      else if($month=="Jul")
      { $fd=2; }
      else if($month=="Sep" || $month=="Dec")
      { $fd=3; }
      else if($month=="Oct")
      { $fd=5; }
    }
    
    // и так далее :)

    Реализация календаря :)

    guest, 12 Декабря 2008

    Комментарии (10)
  5. ActionScript / Говнокод #136

    −453.9

    1. 1
    2. 2
    //_domain = url.match(/http\:\/\/(.*?)\/.*/is)[1]; не работает с https
    _domain =  url.substr(url.indexOf("://")+3).substr(0,url.substr(url.indexOf("://")+3).indexOf("/"));

    не работает никак

    guest, 12 Декабря 2008

    Комментарии (80)
  6. ActionScript / Говнокод #135

    −452.5

    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
    z=1;
    b1.onRelease = function() {
        if(xo1._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo1._alpha=100;
        xo1.gotoAndStop(z);}
    };
    
    b2.onRelease = function() {
        if(xo2._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo2._alpha=100;
        xo2.gotoAndStop(z);}
    };
    
    b3.onRelease = function() {
        if(xo3._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo3._alpha=100;
        xo3.gotoAndStop(z);}
    };
    
    b4.onRelease = function() {
        if(xo4._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo4._alpha=100;
        xo4.gotoAndStop(z);}
    };
    
    b5.onRelease = function() {
        if(xo5._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo5._alpha=100;
        xo5.gotoAndStop(z);}
    };
    
    b6.onRelease = function() {
        if(xo6._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo6._alpha=100;
        xo6.gotoAndStop(z);}
    };
    
    b7.onRelease = function() {
        if(xo7._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo7._alpha=100;
        xo7.gotoAndStop(z);}
    };
    
    b8.onRelease = function() {
        if(xo8._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo8._alpha=100;
        xo8.gotoAndStop(z);}
    };
    
    b9.onRelease = function() {
        if(xo9._alpha!=100){
        z+=1;
        if(z>2){z=1}
            xo9._alpha=100;
        xo9.gotoAndStop(z);}
    };

    Интерфейс крестиков-ноликов на флеше, AS.

    guest, 12 Декабря 2008

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

    −593.8

    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
    Dim cr
    
    Private Function click()
    If cr = 0 Then
    cr = 1
    click = "X"
    Else
    cr = 0
    click = "O"
    End If
    End Function
    Private Sub CommandButton1_Click()
    If CommandButton1.Caption = "" Then CommandButton1.Caption = click()
    End Sub
    
    Private Sub CommandButton10_Click()
    cr = 0
     CommandButton1.Caption = ""
     CommandButton2.Caption = ""
     CommandButton3.Caption = ""
     CommandButton4.Caption = ""
     CommandButton5.Caption = ""
     CommandButton6.Caption = ""
     CommandButton7.Caption = ""
     CommandButton8.Caption = ""
     CommandButton9.Caption = ""
     
    End Sub
    
    Private Sub CommandButton2_Click()
    If CommandButton2.Caption = "" Then CommandButton2.Caption = click()
    
    End Sub
    
    Private Sub CommandButton3_Click()
    If CommandButton3.Caption = "" Then CommandButton3.Caption = click()
    End Sub
    
    Private Sub CommandButton4_Click()
    If CommandButton4.Caption = "" Then CommandButton4.Caption = click()
    End Sub
    
    Private Sub CommandButton5_Click()
    If CommandButton5.Caption = "" Then CommandButton5.Caption = click()
    End Sub
    
    Private Sub CommandButton6_Click()
    If CommandButton6.Caption = "" Then CommandButton6.Caption = click()
    End Sub
    
    Private Sub CommandButton7_Click()
    If CommandButton7.Caption = "" Then CommandButton7.Caption = click()
    End Sub
    
    Private Sub CommandButton8_Click()
    If CommandButton8.Caption = "" Then CommandButton8.Caption = click()
    End Sub
    
    Private Sub CommandButton9_Click()
    If CommandButton9.Caption = "" Then CommandButton9.Caption = click()
    End Sub

    Крестики-нолики на Power Point за 2 минуты.

    guest, 12 Декабря 2008

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

    +44

    1. 1
    document.getElementById(element.id).checked = true;

    guest, 12 Декабря 2008

    Комментарии (27)
  9. Pascal / Говнокод #131

    +23

    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
    if not MultiThread then
      begin
        GetName(@rec);
        result:=rec.fname;
      end
      else
      begin
        hThread:=CreateThread(0,0,@GetName,@rec,0,tmp);
        if WaitForSingleObject(hThread,100)=WAIT_TIMEOUT then
          TerminateThread(hThread,0)
        else
          result:=rec.fname;
        CloseHandle(hThread);
      end;

    Дельфисты - ущербные люди......

    guest, 12 Декабря 2008

    Комментарии (12)
  10. Python / Говнокод #130

    −229.2

    1. 1
    2. 2
    3. 3
    4. 4
    try:
        tray.pop_item('Note')
    except:
        pass

    Этот код вытаскивает (вытаскивал) элемент из трея. На каждом кадре. %)

    guest, 12 Декабря 2008

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