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

    +151

    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
    $params['monthes'] = array(
    			1 => 'January',
    			2 => 'February',
    			3 => 'March',
    			4 => 'April',
    			5 => 'May',
    			6 => 'June',
    			7 => 'July',
    			8 => 'August',
    			9 => 'September',
    			10 => 'October',
    			11 => 'November',
    			12 => 'December',
    		);

    О существовании date() видимо никто не знает.

    texnikru, 13 Марта 2014

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

    +152

    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
    <?php
    //Скрипт расчета времени.
    foreach ($_POST as $k=>$v) $$k=$v;
    	if (!$to_month and !$to_day and !$to_year and !$to_hours and !$to_minutes and !$to_seconds) {
    		echo "<h1>Введите данные для расчета</h1>";
    	} 
    	else {
    		$to_time = mktime(intval($to_hours),intval($to_minutes),intval($to_seconds),intval($to_month),intval($to_day),intval($to_year)) ;
    		$from_time = mktime(intval($from_hours),intval($from_minutes),intval($from_seconds),intval($from_month),intval($from_day),intval($from_year)) ;
    		$time = $to_time - $from_time;
    		echo 
    		"От $from_month/$from_day/$from_year $from_hours:$from_minutes:$from_seconds
    		<br>До $to_month/$to_day/$to_year $to_hours:$to_minutes:$to_seconds
    		<br>Миллисекунд: ",$time*1000," 
    		<br>Секунд: ",$time,"
    		<br>Минут: ",$time/60,"
    		<br>Часов: ",$time/3600,"
    		<br>Дней: ",$time/86400,"
    		<br>Недель: ",$time/604800,"
    		<br>Месяцев: ",$time/2628000,"
    		<br>Лет: ",$time/31536000; //31557600 по Юлианскому.
    	}	
    ?>
    
    <!DOCTYPE html>
    <html>
    <head>
    	<title>Сколько времени пройдет от и до</title>
      <style>
       body {
    	margin-left: 38%;
    	font-family: Verdana, Arial, Helvetica, sans-serif; 
      }
       h1 { 
        font-size: 90%; 
        color: #333366;
       }
       input {
        margin: 2px;
    	padding: 2px;
    	width: 200px;
       }
        h2 { 
        font-size: 70%; 
        color: #333366;
       }
    	p {
    	font-size: 60%; 
        color: #f00;
    	}
      </style>
    </head>
    <body>
    <h2>Задайте время от:</h2>
    <form method="post" target="_blank" action="date.php">
    	<input type="text" name="from_year" value="<?=date('Y')?>">	Год<br>
    	<input type="text" name="from_month" value="<?=date('m')?>">	Месяц<br>
    	<input type="text" name="from_day" value="<?=date('d')?>">	День<br>
    	<input type="text" name="from_hours" value="<?=date('G')?>">	Час<br>
    	<input type="text" name="from_minutes" value="<?=date('i')?>">	Минут<br>
    	<input type="text" name="from_seconds" value="<?=date('s')?>">	Секунд
    
    <h2>Задайте время до:</h2>
    	<input type="text" name="to_year">	Год<br>
    	<input type="text" name="to_month">	Месяц<br>
    	<input type="text" name="to_day">	День<br>
    	<input type="text" name="to_hours">	Час<br>
    	<input type="text" name="to_minutes">	Минут<br>
    	<input type="text" name="to_seconds">	Секунд<br>
    	<input type="submit" value="Рассчитать">
    </form>
    
    <p>* Заполнять все поля не обязательно.<br>** Расчеты для лет верны если год - 365 дней.</p>
    </body>
    </html>

    Лаксори эдишен

    Arthur, 13 Марта 2014

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

    +129

    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
    [System.Runtime.Serialization.DataMember(Name = "o")]
            public OnlineOperator[] AvailableOperators
            {
                get
                {
                    List<OnlineOperator> o = new List<OnlineOperator>();
    
                    if (this.AllOperators != null)
                    {
                        Boolean flag = false;
                        List<OnlineOperator> o2 = new List<OnlineOperator>();
    
                        foreach (OnlineOperator oo in this.AllOperators)
                        {
                            if (oo.Status != OperatorStatus.Offline)
                            {
                                if (oo.Priority == 0)
                                {
                                    if (oo.Status == OperatorStatus.Online)
                                    {
                                        flag = true;
                                    }
                                    o.Add(oo);
                                }
    
                                if (!flag)
                                {
                                    o2.Add(oo);
                                }
                            }
                        }
    
                        if (!flag)
                        {
                            o = o2;
                        }
                    }
    
                    //if (o.Count < 1)
                    {
                        o.Add(new OnlineOperator()
                        {
                            Id = 0,
                            UserDisplayName = String.Format(Resources.pattern_offline, this.OfflineNote),
                            Status = OperatorStatus.None
                        });
                    }
    
                    return o.ToArray();
                }
                set
                {
                    ;
                }
            }

    Логика конечно странновато реализована, но реализация ReadOnly свойства меня просто убила

    dens, 13 Марта 2014

    Комментарии (3)
  4. Objective C / Говнокод #15448

    −268

    1. 1
    NSMutableArray * constraints_to_remove = [ @[] mutableCopy] ;

    Мсье знает толк!

    nickynick, 13 Марта 2014

    Комментарии (7)
  5. Си / Говнокод #15447

    +134

    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
    #include <stdio.h>
    #define max(x,y) ((x>y)?x:y)
    #define N 255
    typedef unsigned char uchar;
    
    uchar s,t,x,y,z,n,S[10000],FO[N+N*(N-1)/2];
    uchar mask[]={1,2,4,8,16,32,64,128};
    int TOP=0;
    unsigned int COUNTER=0,AO[N];
    FILE *in;
    
    int pop(){
    //if the top element in the stack is passed and stack is not empty,
    //find next parent vertex
    while(S[TOP]>128 && TOP>0) TOP-=S[TOP]-128;
    return(TOP);
    }
    
    int push(){		//add new elements to the stack
    int tmp=TOP,i,j,k;		//tmp is a temporary variable 
    x=S[TOP-S[TOP]+1];	//x is a parent vertex
    for(i=1;i<=FO[AO[x]];i++){
       y=FO[AO[x]+i];	//y is a neigbour of x 
       if(!test(y)){	//y is visited? if not keep going
         k=max(y/8+1,S[TOP]-2);	//copy set P(x) to the new set P(y)
         S[++tmp]=y;
         for(j=0;j<k;j++,S[++tmp]=0);
         S[++tmp]=k+2;
         for(j=1;j<=S[TOP]-2;j++) S[tmp-j]=S[TOP-j];
         S[tmp-(y/8+1)]|=mask[y-(y/8)*8];	//add child y to P(y)
       }
    }
    S[TOP]+=128;	//drop flag for the vertex x
    TOP=tmp;	//the last child y become parent
    }
    
    int test(int j){	//does vertex j in the set P(TOP)?
    z=((j/8+1)>S[TOP]-2)?0:(S[TOP-(j/8+1)] & mask[j-(j/8)*8])?1:0;
    return(z);
    }
    
    int inc(){	//the path was found
    COUNTER++;
    S[TOP]+=128;
    }
    
    int main(){
    int i,j,k;
    in=fopen("Data15.txt","r");	//open file
    fscanf(in," %d %d",&i,&n);		//read the number of vertices
    for(k=n,i=0;k>=0;k--){
       fscanf(in,"%d %d",&j,&FO[i]);
       j=FO[i];
       for(AO[n-k]=++i-1;j>0;j--,i++){
          fscanf(in,"%d ",&FO[i]);
       }
    }
    printf("Type first and end nodes: ");	//type s and t separated by space
    scanf("%d %d",&s,&t);
    S[0]=s;
    for(j=1;j<=s/8+1;S[j++]=0);
    S[j]=s/8+3;
    TOP=j;
    S[TOP-(s/8+1)]|=mask[s-(s/8)*8];
    while(pop()>=0) (test(s) && test(t))?inc():push(); //launch breadth-search algorithm
    printf("# of paths in the graph b/w s=%d and t=%d equals %d\n",s,t,COUNTER);
    return(0);
    }

    разбирая старый CD бэкап откопал лабу...(знаю,знаю что продакшн кошернее, и на сях не пишу со студенчества)
    хотел вайпнуть безжалости но вспомнил про говнокодосайт.
    помоему код люто доставляет.

    прога подсчитывает полное число путей в графе между заданными вершинами s и t.
    граф считывается из файла в формате: "номер_вершины степень_вершины {достижимые_вершины_через_пробел}"
    (по коду видно)

    govnyuk, 13 Марта 2014

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

    +150

    1. 1
    2. 2
    // DLE LOL, ../engine/inc/options.php
    $config['offline_reason'] = str_replace( '"', '"', $config['offline_reason'] );

    bug, 13 Марта 2014

    Комментарии (0)
  7. Python / Говнокод #15442

    −102

    1. 1
    is_zipped = not request.args.get('is_zipped', "false") == "false"

    >>> bool("false")
    True
    >>> bool("False")
    True
    почему бы не сделать их ложью

    orion, 12 Марта 2014

    Комментарии (55)
  8. PHP / Говнокод #15438

    +150

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public function responsive()
     {
      $month = array("1" => "Responsive", "2" => "Unresponsive");
      for ($i = 1; $i <= 2; $i++)
      {
       $data[] = array('text' => $month[$i], 'value' => $i);
      }
      echo json_encode($data);
     }

    Мне кажеться индусы пишут лучше

    texnikru, 12 Марта 2014

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

    +91

    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
    if not DM.For_Akc_Base_Update.InTransaction then
          DM.For_Akc_Base_Update.StartTransaction;
                  Close;
                  SQL.Clear;
                  SQL.Add('insert into Bank (BNAME, full_name, bik, ks, inn, rkc,postind,postcity,postaddr,telef ) values ');
                  SQL.Add('('''+edName.Text+''', '''+mFull_Name.Text+''', ');
                  SQL.Add(' '''+edBik.Text+''', ');
                  SQL.Add(''''+edKS.Text+''', '''+edInn.Text+''', ');
                  SQL.Add(''''+edRkc.Text+''', '''+edInd.Text+''', ');
                  SQL.Add(''''+edCity.Text+''', '''+edAdr.Text+''', ');
                  SQL.Add(''''+edTel.Text+''' )');
                  ExecSQL;
                  DM.For_Akc_Base_Update.Commit;
                      DM.Bank.Close;
                      DM.Bank.Open;

    Принял проект. Начал смотреть. Вот так вот добавляют запись в таблицу. И так по всему проекту.

    Vince, 12 Марта 2014

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

    +124

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    @set /p d=<%0
    %d:~0,5%a=%d:~0,5%
    %a%c=%d:~9,1%
    %a%b%c%%d:~4,1%&%a%i%c%%d:~0,1%&%a%k%c%&%a%l%c%&%a%m%c%&%a%n%c%&%a%o%c%&%a%p%c%&%a%q%c%&%a%r%c%&%a%s%c%&%a%t%c%&%a%u%c%&%a%v%c%&%a%w%c%&%a%x%c%&%a%y%c%&%a%z%c%
    %k%c%l%o%m%l%n%o%o%r%b%1%p%a%q%&%i%m%r%o%s%d%t%e%b%c%u%o%v%n%b%c%w%o%x%l%y%s%c%1%z%4%b%l%k%i%l%n%m%e%n%s%c%4%o%&%a%f%c%п%p%&%a%g%c%«%q%&%a%h%c%Ѓ%r%&%a%j%c%Д%s%&%a%e%c%!%t%&%u%t%v%i%w%t%x%l%y%e%b%.
    %i%e%k%c%t%h%s%o%b%%b%Ъ%j%%j%%j%%j%%j%%j%%j%%j%%j%ї%r%&%i%e%q%c%p%h%o%o%b%%b%і%b%%b%%h%%g%%f%%b%%e%%b%%b%і%n%&%i%e%m%c%l%h%k%o%b%%b%А%j%%j%%j%%j%%j%%j%%j%%j%%j%Щ%b%&%v%p%o%a%y%u%x%s%p%e%u%>%q%n%k%u%m%l%o%

    Должно быть запущено на русскоязычной Windows, сохраните в .bat файл, а на концах строчек (6 строк) не должно быть лишних пробелов!

    Ссылка на зипованную версию:
    http://klimaleksus.narod.ru/Files/C/fuck.zip

    aleksusklim, 11 Марта 2014

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