1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #4690

    +148

    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
    for($i = 5; $i <= 11; $i++)
    {
        echo "<tr>\n";
        echo "<td valign=\"top\">\n<b>$i</b>\n</td>\n\n";
        /* для каждого дня */
        foreach($dayslt as $day)
        {
          echo "<td>\n";
          for($lesson_num = 1; $lesson_num <= 6; $lesson_num++)
          {
           echo "<input type=\"text\" name=\"lesson[$i][$day][$lesson_num]\"><br/>\n";
          }
          echo "</td>\n\n";
        }
        echo "</tr>\n\n";
    }

    какая-то хуйня по вводу расписания, хз

    varg242, 19 Ноября 2010

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

    +98

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    template<unsigned AxesQount, class Conten>
    const Vector<AxesQount, Conten> Vector<AxesQount, Conten>::operator-(void) const
    {
        return *this*-1.0;
    };
    
    template<unsigned AxesQount, class Conten>
    const Vector<AxesQount, Conten> Vector<AxesQount, Conten>::operator+(void) const
    {
        return *this;
    };

    Чужой велосипед. Пытался использовать в своём проекте, но передумал.

    Говногость, 07 Мая 2010

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

    0

    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
    include( 'includes/systems/header.inc' ); #Подключение Заголовка
    
    @list($wdth,$hght) = getImageSize( $_GET['photo'] );
    
    while( ( $wdth > $_SESSION['wdth']-100 ) || ( $hght > $_SESSION['hght']-100 ) ){
    $wdth = $wdth / 1.00001;
    $hght = $hght / 1.00001;
    }
    # echo $wdth . 'x' . $hght ;
    # $hghtP = $hght - 85;
    # $wdthP = $wdth - 85;
    $hghtP = $hght;
    $wdthP = $wdth;
    
    
    @$prms = ( $wdth > $hght )? 'width=' . (int)$wdthP: 'height=' . (int)$hghtP;
    # echo $wdth . 'x' . $hght;

    photo.php

    GAMER, 26 Декабря 2022

    Комментарии (70)
  5. Python / Говнокод #27980

    0

    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
    def res_horizontal(self, btn):
            self.im = Image.open(self.new_img)
            if btn.text() == "320x240":
                self.new_im = self.im.resize((320, 240))
            elif btn.text() == '1024x600':
                self.new_im = self.im.resize((1024, 600))
            elif btn.text() == '1280x720':
                self.new_im = self.im.resize((1280, 720))
            elif btn.text() == '1440x900':
                self.new_im = self.im.resize((1440, 900))
            elif btn.text() == '1600x1024':
                self.new_im = self.im.resize((1600, 1024))
            elif btn.text() == '1920x1080':
                self.new_im = self.im.resize((1920, 1080))
            elif btn.text() == '2048x1536':
                self.new_im = self.im.resize((2048, 1536))
            elif btn.text() == '2560x1440':
                self.new_im = self.im.resize((2560, 440))
            elif btn.text() == '3840x2160':
                self.new_im = self.im.resize((3840, 2160))
            elif btn.text() == '4096x2160':
                self.new_im = self.im.resize((4096, 2160))
            elif btn.text == '800x480':
                self.new_im = self.im.resize((800, 480))
    
            self.new_im.save(self.new_img)
    
        def res_vertical(self, btn):
            self.im = Image.open(self.new_img)
            if btn.text() == '240x320':
                self.new_im = self.im.resize((240, 320))
            elif btn.text() == '480x800':
                self.new_im = self.im.resize((480, 800))
            elif btn.text() == '600x1024':
                self.new_im = self.im.resize((600, 1024))
            elif btn.text() == '720x1280':
                self.new_im = self.im.resize((720, 1280))
            elif btn.text() == '900x1440':
                self.new_im = self.im.resize((900, 1440))
            elif btn.text() == '1024x1600':
                self.new_im = self.im.resize((1024, 1600))
            elif btn.text() == '1080x1920':
                self.new_im = self.im.resize((1080, 1920))
            elif btn.text() == '1536x2048':
                self.new_im = self.im.resize((1536, 2048))
            elif btn.text() == '1440x2560':
                self.new_im = self.im.resize((1440, 2560))
            elif btn.text() == '2160x3840':
                self.new_im = self.im.resize((2160, 3840))
            elif btn.text() == '2160x4096':
                self.new_im = self.im.resize((2160, 4096))
    
            self.new_im.save(self.new_img)
    
        def res_square(self, btn):
            self.im = Image.open(self.new_img)
            if btn.text() == '320x320':
                self.new_im = self.im.resize((320, 320))
            elif btn.text() == '800x800':
                self.new_im = self.im.resize((800, 800))
            elif btn.text() == '1280x1280':
                self.new_im = self.im.resize((1280, 1280))
            elif btn.text() == '1024x1024':
                self.new_im = self.im.resize((1024, 1024))
            elif btn.text() == '1600x1600':
                self.new_im = self.im.resize((1600, 1600))
            elif btn.text() == '1440x1440':
                self.new_im = self.im.resize((1440, 1440))
            elif btn.text() == '1920x1920':
                self.new_im = self.im.resize((1920, 1920))
            elif btn.text() == '2048x2048':
                self.new_im = self.im.resize((2048, 2048))
            elif btn.text() == '3840x3840':
                self.new_im = self.im.resize((3840, 3840))
            elif btn.text() == '2560x2560':
                self.new_im = self.im.resize((2560, 2560))
            elif btn.text() == '4096x4096':
                self.new_im = self.im.resize((4096, 4096))
    
            self.new_im.save(self.new_img)

    Давным давно на pyqt писал этот говнокод, теперь ржу над ним

    ponos334, 31 Января 2022

    Комментарии (70)
  6. Куча / Говнокод #27427

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Inductive my_bool :=
    | my_false
    | my_true.
    
    Theorem shit_happens:
      (if my_false then 42 else 100500) = 42.
    Proof.
      reflexivity.
    Qed.

    Какая типизация )))

    bormand, 14 Мая 2021

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    match group_shapes():
        case [], [point := Point(x, y), *other]:
            print(f"Got {point} in the second group")
            process_coordinates(x, y)

    https://www.python.org/dev/peps/pep-0622/

    DypHuu_niBEHb, 31 Марта 2021

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

    0

    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
    //библиотеки cuda_runtime.h и device_launch_parameters.h
    //для работы с cyda
    #include "cuda_runtime.h"
    #include "device_launch_parameters.h"
    #include<vector>
    #include<string>//для getline
    #include <stdio.h>
    #include<fstream>
    using namespace std;
    __global__ void Upload_to_GPU(unsigned long long  *Number,unsigned long long  *Stepn, bool *Stop,unsigned long long  *INPUT,unsigned long long  *max) {
    	int thread = threadIdx.x;
    	unsigned long long  MAX_DEGREE_OF = max[0];
        int X = thread;
    	unsigned long long  Calculated_number = 1;
    	unsigned long long  Current_degree_of_number = 2;
        unsigned long long   Original_numberP = INPUT[0];
    	Stop[thread] = false;
    	bool BREAK = false;
    	if (X!=0&&X!=1) {
    		while (!BREAK) {
    			if (Current_degree_of_number <= MAX_DEGREE_OF) {
    				Calculated_number = 1;
    				for (int counter = 0; counter < Current_degree_of_number; counter++) {
    				 Calculated_number	*=X;
    				}
    				if (Calculated_number == Original_numberP) {
    					Stepn[thread] = Current_degree_of_number;
    					Number[thread] = X;
    					Stop[thread] = true;
    					BREAK = true;
    				}
    				Current_degree_of_number++;
    			}
    			else { BREAK = true; }
    		}
    	}
    }

    https://habr.com/post/525892/
    > Сравнение времени выполнения алгоритма на CPU и GPU

    gost, 31 Октября 2020

    Комментарии (70)
  9. Си / Говнокод #26906

    +1

    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
    /// Checks if the token is number or not
    bool is_number(char* test_val)
    {
        const char* ROW = "0123456789\0";
        
        for (int i = 0; i < strlen(test_val); i++) {
            for (int j = 0; j < strlen(ROW); j++) {
                if (test_val[i] == ROW[j]) {
                    goto next;
                }
            }
            return false;
            next:
        }
        return true;
    }

    Попытка проверить строку на число в Си.

    GDMaster, 02 Сентября 2020

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    try
           {
                await storageClient.DownloadObjectAsync(Bucket, fileName, stream).ConfigureAwait(false);
           }
        catch(Exception ex)
           {
                throw new FileStorageException($"File '{fileName}' not found in a bucket '{Bucket}'", ex) { StatusCode = StatusCodes.Status404NotFound };
           }

    Сеньйор дот нет девелопер

    horil97821, 26 Марта 2020

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

    0

    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
    /* Infinite loop */
      /* USER CODE BEGIN WHILE */
      while (1)
      {
        Master_Slave_Check();
        if (CtrlBrd_Mode == 1) //MasterMode
        {
          SSPC_Check_Proc();      
          Read_ADC();
          Logic();
          RS_Enable();
          Obmen_RS();
          //CAN_Enable();
          //Obmen_CAN();
          
          //if (SoftFlag.Flag1.bit.History_Wr_Req)
          //{
          //  SoftFlag.Flag1.bit.History_Wr_Req = 0;
          //  Write_History();
          //}
          
          HAL_IWDG_Refresh(&hiwdg);	//Dog reset
          
          Migalka();    //Working LED blink
        }
        else if (CtrlBrd_Mode == 0) //SlaveMode
        {
          Slave_DeInit();
          while(1)
          {
            Master_Slave_Check();
            if (CtrlBrd_Mode == 1)    //если плата снова стала мастером, когда сдох основной мастер,
              HW_RESET();             //делаем аппаратный сброс для перезапуска (нога выставляется в 1, отпирает транзюк VT9, который садит на землю вход управления тракой)
            HAL_IWDG_Refresh(&hiwdg);	//Dog reset
            Migalka();
          }
        }
      }
      /* USER CODE END WHILE */
    }

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

    ykypeHHbIu_nemyx, 10 Июля 2019

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