1. Си / Говнокод #5938

    +138

    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
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <ctime>
    #include <signal.h>
    #include <sys/time.h>
    #include <fcntl.h>
    #include <termios.h>
    #include <time.h>
    
    #include <iostream>
    
    using namespace std;
    
    struct termios savetty;
    struct termios tty;
    char num[]="0123456789QWERTYUIOPASDFGHJKLZXCVBNM";
            char let[]="!\",#$%&'()*qwertyuiopasdfghjklzxcvbnm";
    int t=1;
    int tm=0;
    int opnum=0;
      char buffer[30];
    char var[1000];
    char out[1000];
    struct timeval tv;
    struct timeval tv2;
    int main()
    {
      if ( !isatty(0) ) {
      fprintf (stderr, "stdin not terminal\n");
      exit (1);
      };
    
    tcgetattr (0, &tty);
    savetty = tty;
    tty.c_lflag &= ~(ICANON|ISIG);
    tty.c_cc[VMIN] = 1;
    tcsetattr (0, TCSAFLUSH, &tty);
    
      srand(time(0));
    
      int i=0;
      bool c=true;
      time_t curtime;
      int passLen=200+rand()%400;
      for(int i=0;i<=passLen;i++){
        int s=rand()%2;
        if(s==1){
          out[i]=let[rand()%37];
        } else {
          out[i]=num[rand()%35];
        };
        if((i%5)==0 && i!=0)out[i]=' ';
      };
      out[passLen]='\0';
      int tt=gettimeofday(&tv, NULL);
      if(tt<0)exit(0);
      printf("%s\n",out);
      while(out[i]!='\0')
      {
        var[i]=getchar();
        if(var[i]!=out[i]){
          opnum++;
          printf("Er%c",out[i]);
        };
        i++;
      };
      tt=gettimeofday(&tv2, NULL);
      if(tt<0)exit(0);
      int tm=tv2.tv_sec-tv.tv_sec;
      int v=(passLen*60)/tm;
      int min=tm/60;
      tm%=60;
      printf("Time %d min %d sec\n",min,tm);
      cout<<"Num of errors "<<opnum<<" Speed "<<v<<endl;
      tcsetattr (0, TCSAFLUSH, &savetty);
      
    };

    Клавиатурный тренажер

    AliceGoth, 09 Марта 2011

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

    −182

    1. 1
    2. 2
    3. 3
    4. 4
    - application = webapp.WSGIApplication(foo)	
    + if 0==1:	
    +     application = webapp.WSGIApplication(foo)
    + application = webapp.WSGIApplication(bar)

    пакистанский юноша знает толк в комментариях.

    awsum, 09 Марта 2011

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

    −91

    1. 1
    2. 2
    3. 3
    4. 4
    if ((m_window.popupBox_mc.popupBox_tf.text == "Пожалуйста обратитесь в службу поддержки и опишите действия после которых возникла ошибка. Затем обновите страницу.")||(m_window.popupBox_mc.popupBox_tf.text == "Ошибка ресурсов сервера. Пожалуйста обратитесь в службу поддержки и опишите действия после которых возникла ошибка. Затем обновите страницу.")||(m_window.popupBox_mc.popupBox_tf.text == "Ты запустил игру в двух браузерах или окнах одновременно. Закрой одно из окон и обнови страницу!")||(m_window.popupBox_mc.popupBox_tf.text == GlobalEngine.quickLocalize("FarmGame", "ServerError"))||(m_window.popupBox_mc.popupBox_tf.text == GlobalEngine.quickLocalize("FarmGame", "RefreshGame")))
    {				
    m_window.popupBox_mc.accept_bt.visible = false;
    }

    jahnique, 09 Марта 2011

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

    +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
    <?php
    include("db.php");
    $query = "SELECT * FROM dbtest";
    $result = mysql_query($query);
    $fp = fopen("~/.ihmiheiha.conf", "w");
    if (!$fp)
    die("Ты намутил что-то не то... ведь всё работало");
    while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
    $ihm=$row[0];
    $ihe=$row[1];
    $iha=$row[2];
    $filed = "tnkf: $ihm, tnkd: $ihe, tnka: $iha";
    fwrite($fp, $filed);
    }
    mysql_close ( $db );
    fclose($fp);
    ?>
    <html>
    <body>
    <form action='del.php' method='post'>
    <?php
    include("db.php");
    $query = "SELECT * FROM dhcpd";
    $result = mysql_query ( $query );
    $n = mysql_num_rows ( $result );
    for ( $i=0; $i<$n; $i++ )
      {
       $row = mysql_fetch_array($result);
       echo "<p><b><input type='checkbox' name='".($i+1)."' value='1'>";
       echo " ".($i+1).". Host: $row[ihm]</b></br>";
       echo "<b>MAC адрес:</b> $row[ihe]<br>";
       echo "<b>IP адрес:</b> $row[iha]</p>";
       }
    if ( $n == 0 ) echo "Никого нет.";
    mysql_close ( $db );
    ?>
    </form>
    <center>
    <div style="float:left">
    <FORM ACTION="add.php">
    <INPUT TYPE="submit" VALUE="Добавить">
    </FORM></div>
    <div style="float:left">
    <FORM ACTION="del.php">
    <INPUT TYPE="submit" VALUE="Удалить">
    </FORM>
    </div>
    <div style="float:left">
    <FORM ACTION="<?php echo $PHP_SELF?>">
    <INPUT TYPE="submit" VALUE="Применить изменения">
    </FORM>
    </div>
    </center>
    </body>
    </html>

    qbasic, 09 Марта 2011

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

    +162

    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
    $i = 0;
            while ($recup[$i] || $stop != 1){
                if ($recup[$i] == 'u' && $recup[$i + 1] == 's' && $recup[$i + 2] == 'e' && $recup[$i + 3] == 'r' && $recup[$i + 4] == '/'){
                    $k = $i;
                    $stop = 1;
                }
                $i++;
            }
            $k += 5;
            $j = 0;
            while ($recup[$k] != '/'){
                $uid_friend[$j] = $recup[$k];
                $k++;
                $j++;
            }
            $l = 0;
            while ($uid_friend[$l]){
               $final_uid = $final_uid.$uid_friend[$l];
               $l++;
            }

    выборка из html кода строки вида .../user/123123/...

    psych, 09 Марта 2011

    Комментарии (0)
  6. JavaScript / Говнокод #5933

    +161

    1. 1
    var CURRENCY = {$company_info|@json_encode}.currency;

    Вот такой код встретился в проекте в одном из Smarty шаблонов
    $company_info - некий ассоциативный массив.

    x86demon, 09 Марта 2011

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

    +167

    1. 1
    2. 2
    3. 3
    function my_sql_query($query){
        return mysql_query($query);
    }

    warider, 09 Марта 2011

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

    −107

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    try
    {
    	compressedData.uncompress();
    }
    catch (e:Error)
    {
    	throw e;
    }

    jahnique, 09 Марта 2011

    Комментарии (5)
  9. SQL / Говнокод #5930

    −860

    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
    SELECT i.id AS i__id, i.title AS i__title, i.description AS i__description, i.meta_title AS i__meta_title, i.meta_keywords AS i__meta_keywords, i.meta_description AS i__meta_description, i.lang AS i__lang FROM item_translation i WHERE (i.id IN ('8845'))
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Акция' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Акция' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Розница' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Оптом' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Безнал' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Дилер' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Кредит' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT p.id AS p__id, p.item_id AS p__item_id, p.type AS p__type, p.currency AS p__currency, p.value AS p__value, p.date AS p__date FROM price p WHERE (p.item_id = '8845' AND p.type = 'A') ORDER BY p.date DESC LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'В корзину' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'В корзину' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection

    Это часть запросов которые выполняются для генерации главной страницы для одного интернет магазина. И таких запросов: 360 :-)

    aleksey, 09 Марта 2011

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

    +146

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                                    <td id="menu"><a id="1" href="javascript:void(0);">Link 1</a></td>
                                    <td id="menu"><a id="2" href="javascript:void(0);">Link 2</a></td>
                                    <td id="menu"><a id="3" href="javascript:void(0);">Link 3</a></td>
                    </tr>                
    </table>

    ну вкладки html тут нет

    nepster, 09 Марта 2011

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