1. Куча / Говнокод #11791

    +132

    1. 1
    2. 2
    3. 3
    <style Language="JavaScript">
    ...
    </style>

    WUT

    mr.The, 18 Сентября 2012

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

    +40

    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
    Function DateDiff ($interval,$date1,$date2)
    {
        // получает количество секунд между двумя датами 
        $timedifference = $date2 - $date1;
    
        switch ($interval) {
            case 'w':
                $retval = bcdiv($timedifference,604800);
                break;
            case 'd':
                $retval = bcdiv($timedifference,86400);
                break;
            case 'h':
                $retval =bcdiv($timedifference,3600);
                break
            case 'n':
                $retval = bcdiv($timedifference,60);
                break;
            case 's':
                $retval = $timedifference;
                break;
                
        }
        return $retval;
    
    }

    Не моё, где-то на просторах интернета обнаружил.

    varg242, 18 Сентября 2012

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

    +46

    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
    $confs = array();
    
    		$q = new WP_Query(array('post_type' => 'conference',
    					'posts_per_page' => -1,
    					'meta_key' => 'cd-conference-date-start',
    					'orderby' => 'meta_value_num',
    					'order' => 'DESC'
    					));
    
    		while($q->have_posts()): $q->the_post();
    		$confs[date("Y", get_post_meta($post->ID, 'cd-conference-date-start', true))][] = array('conf_title' => get_the_title(),
    												      'conf_date_start' => get_post_meta($post->ID, 'cd-conference-date-start', true),
    												      'conf_date_end' => get_post_meta($post->ID, 'cd-conference-date-end', true),
    												      'conf_link' => get_permalink(),
    												      'conf_city' => get_post_meta($post->ID, 'cd-conference-city', true),
    												      'conf_icon' => get_the_post_thumbnail()
    												      );
    		endwhile;
    
    		wp_reset_postdata();

    WordPress. Глубже, чем вы себе можете представить.

    varg242, 17 Сентября 2012

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

    +127

    1. 1
    override def text: String = super.text

    https://github.com/scala/scala/blob/master/src/library/scala/xml/Node.scala

    rat4, 17 Сентября 2012

    Комментарии (1)
  5. C++ / Говнокод #11786

    +19

    1. 1
    Lennart lennart=new Lennart;

    Надпись жёлтым цветом на гпавном меню minecraft.

    dos_, 17 Сентября 2012

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

    +57

    1. 1
    if( $data['id_Account'] =! $this->user->Account )

    somnambulism, 17 Сентября 2012

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

    +74

    1. 1
    2. 2
    //переворачиваем массив с ног на голову, отрезаем голову, чтоб осталось 10 элементов и ставим все что осталось на ноги
    $_lasts = array_reverse(array_splice(array_reverse($last_view), 5));

    "казнь" массива

    Mihard, 17 Сентября 2012

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

    +38

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    SkinDog* crateDog()
    {
      return reinterpret_cast<SkinDog*>( new Dog() );
    };
    void deleteDog( SkinDog* pDog)
    {
      delete reinterpret_cast<Dog*>( pDog );
    }
    
    EvilDog::bite() 
    {
      Dog* pDog = mutationDog();

    Не удержался, чтоб не запостить. Сами знаете откуда.

    LispGovno, 17 Сентября 2012

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

    +41

    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
    int sheeps(int pole[10][10])
    {
        int i,j,f,k,r;
        int rand_chislo, rand_chislo1, ts,s; 
      
          srand(time(NULL));      
         for (i=0;i<10;i++)   
          for (j=0;j<10;j++)
          pole [i][j]=0;  
         do{ f=0;                                
            rand_chislo = 0 + rand() %10;
            rand_chislo1= 0 + rand() %10;        
            ts = 1+rand()%4;        
              if (ts==1) {for(i=0;i<3;i++) if(rand_chislo==i)f=1;}
             if (ts==2)  {for(i=7;i<10;i++) if(rand_chislo==i)f=1;}                          
              if (ts==3) {for(i=0;i<3;i++) if(rand_chislo1==i)f=1;}
             if (ts==4)  {for(i=7;i<10;i++) if(rand_chislo1==i)f=1;}       
            }
           while (f==1);
            switch (ts){
              case 1: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo-1][rand_chislo1]=1;
                      pole[rand_chislo-2][rand_chislo1]=1;pole[rand_chislo-3][rand_chislo1]=1; break;
               case 2: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo+1][rand_chislo1]=1; 
                       pole[rand_chislo+2][rand_chislo1]=1;pole[rand_chislo+3][rand_chislo1]=1; break;
             case 3: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1-1]=1;
                     pole[rand_chislo][rand_chislo1-2]=1;pole[rand_chislo][rand_chislo1-3]=1;break;
              case 4: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1+1]=1;
                      pole[rand_chislo][rand_chislo1+2]=1;pole[rand_chislo][rand_chislo1+3]=1; break; }
         
        for (k=0;k<3;k++)                                      
         {
           do{ f=0;
            rand_chislo = 0 + rand() %10;
            rand_chislo1= 0 + rand() %10;       
            ts = 1+rand()%4;       
              if (ts==1)  {if(rand_chislo!=0){ for (i=rand_chislo-2;i<rand_chislo+2;i++)
                                          for (j=rand_chislo1-1;j<=rand_chislo1+1;j++)
                                            {if (pole[i][j]!=0){f=1;}}}else f=1; }
             if (ts==2)  {if (rand_chislo!=9)  {  for (i=rand_chislo-1;i<=rand_chislo+2;i++)
                                              for (j=rand_chislo1-1;j<=rand_chislo1+1;j++)
                                              { if (pole[i][j]!=0){ f=1;}}}else f=1;  }                            
              if (ts==3) { if (rand_chislo1!=0) {   for (i=rand_chislo-1;i<=rand_chislo+1;i++)
                                                for (j=rand_chislo1-2;j<=rand_chislo1+1;j++)
                                                { if (pole[i][j]!=0){ f=1;}}}else f=1;  } 
             if (ts==4) { if (rand_chislo1!=9) {   for (i=rand_chislo-1;i<=rand_chislo+1;i++)
                                                for (j=rand_chislo1-1;j<=rand_chislo1+2;j++)
                                                { if (pole[i][j]!=0){ f=1;}}} 
                                                else f=1;   }                                  
            }
           while (f==1);
            switch (ts){
              case 1: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo-1][rand_chislo1]=1; break;
              case 2: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo+1][rand_chislo1]=1; break;
              case 3: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1-1]=1;break;
              case 4: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1+1]=1; break; }  
         }    
         for (k=0;k<2;k++)                                  
         {
           do{ f=0;
            rand_chislo = 0 + rand() %10;
            rand_chislo1= 0 + rand() %10;
          
     /*зесь еще 2 таких же while (if==1) и for k<3 и k<4 */
    
    return pole[10][10];
    }

    курсовик первокурсника "морской бой". функция расстановки кораблей

    equilibrium, 17 Сентября 2012

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

    +137

    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
    {- Haskell -}
    bruteforceGeneratorWithEasySimplication :: Description d => d -> [StandartTable]
    bruteforceGeneratorWithEasySimplication description =
        let width = size_h description; height = size_v description; vHeader = headerV description in
            do
                table <- genListBasedOn (map lineVariants vHeader)
                return (ST table)
        where
            lineVariants :: [Int] -> [[Bool]]
            lineVariants headerLine = let
                всё_я_задолбался_однако = True -- K.O.
                количество_цельных_блоков = length headerLine
                число_промежутков = количество_цельных_блоков - 1
                число_свободных_пробелов_которые_нам_нужно_распихать_между_цельными_блоками = ширина_поля - суммарная_длина_цельных_блоков
                ширина_поля = size_h description
                суммарная_длина_цельных_блоков = sum headerLine
                
                возможная_строка_использующая :: [Int] -> [Bool]
                возможная_строка_использующая разбиение = replicate (head разбиение) False ++ 
                    concat (zipWith (\x y -> replicate y True ++ replicate x False) (tail разбиение) headerLine)
                
                и = and
                по = undefined
                
                in do
                    разбиение <- получить_разбиение_для_строки по (число_свободных_пробелов_которые_нам_нужно_распихать_между_цельными_блоками) и (число_промежутков)
                    return (возможная_строка_использующая разбиение :: [Bool])
    
    получить_разбиение_для_строки по числу_свободных_элементов и числу_промежутков = do ...

    Из раннего.

    По-видимому, задолбался писать на тарабарщине, захотелось выражаться родными русскими словами.

    Jean-Esther, 16 Сентября 2012

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