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

    В номинации:
    За время:
  2. Куча / Говнокод #24836

    −3

    1. 1
    2. 2
    3. 3
    Открылся новый форум
    https://gvforum.ru
    Присоединяйтесь

    gvforumyan, 29 Сентября 2018

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

    +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
    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
    onStart =: verb define
      wd 'pc game15; pn 15; bin hv; bin h'
      i =. 0
      for_text. ":@>:0,~?~15 do.
        name =. 'a', ":i
        wd 'cc ', name , ' button; cn ', text
        if. 3 = 4|i do.
          wd 'bin z; bin h'
        end.
        wd 'set ', name, ' wh 80 80'
        ". 'game15_', name, '_button =: buttonclicked@]&', (":i)
        i =. >:i
      end.
      wd 'set a15 text'
      wd 'cc count static; cn 0'
      count =: 0
      wd 'bin z'
      wd 'cc restart button; cn restart'
      wd 'pshow'
      empty =: 15
      0$0
    )
    
    buttonclicked =: verb define
      if. 1 = (+/)(**)(-/@:<.@:%&4 , -/@:|~&4) empty, y do.
        wd 'set a', (":empty), ' text ', wd 'get a', (":y), ' text'
        wd 'set a', (":y), ' text'
        empty =: y
        count =: >:count
        wd 'set count text ', ":count
      end.
    )
    
    game15_restart_button =: verb define
      wd 'pclose'
      wd 'activity base'
    )
    
    wd 'activity base'

    Я осилил гуй в J! Урряяяя!

    MasterJoda, 11 Сентября 2018

    Комментарии (30)
  4. Си / Говнокод #24681

    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
    Ну и полный пример:
    
    #include "stdafx.h"
    #include "windows.h"
    #include "iostream.h"
    #include "process.h"			// специально для потока
    
    void  fThredFunct1(void* pv);		// декларация функции потока
    __declspec(thread) DWORD dwTlsIndex;		// локальная статическая функция для потока
    
    void main()
    {
    
    	ULONG hThread1 = 0;		// Идентификатор потока 1
    	ULONG hThread2 = 0;		// Идентификатор потока 2
    	//unsigned long _beginthread( void( __cdecl *start_address )( void * ),
    	//			unsigned stack_size, void *arglist );
    	hThread1 = _beginthread(fThredFunct1,0,NULL);	// создали первый поток
    	if (hThread1==-1)
    		cout << "Error create thread" << endl; 
    	hThread2 = _beginthread(fThredFunct1,0,NULL);	// создали второй поток
    	if (hThread1==-2)
    		cout << "Error create thread" << endl; 
    	Sleep(2000);				// ждем 
    }
    
    void fThredFunct1(void* pv)			// реализация функции потока
    {
    	dwTlsIndex=TlsAlloc();		// Запросить индекс
    	if (dwTlsIndex==-1)		// проверить на ошибку
    	{
    		cout << "Error TlsAlloc " << endl;
    		return;
    	}
    	cout << dwTlsIndex << endl;
    	Sleep(1000);
    
    	if ( TlsFree( dwTlsIndex)==0 )	// освободить индекс
    	{
    		cout << "Error TlsFree" << endl;
    		return;
    	}
    }

    Многопоточное говно
    Гуглояндексится.

    kir_rik, 29 Августа 2018

    Комментарии (30)
  5. JavaScript / Говнокод #24604

    −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
    restrictions = restrictions.filter(restriction =>
    	_.find(solution, item => (
    		(item.from === restriction.from) && (item.to === restriction.to)
    	))
    ).map(restriction => {
    	const solutionTransmission = _.find(
    		solution,
    		item => ((item.from === restriction.from) && (item.to === restriction.to))
    	);
    	if (solutionTransmission) {
    		return restriction;
    	}
    	return null;
    }).filter(restriction => restriction);

    sigod, 09 Августа 2018

    Комментарии (30)
  6. Python / Говнокод #23921

    +2

    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
    Pyhton 2:
    >>> (2**54/1) + 10 - 10 == 2**54
    True
    
    >>> (2**64/1) + 10  == 2**64
    False
    
    Pyhton 3:
    
    >>> (2**54/1) + 10 - 10 == 2**54
    False
    
    >>> (2**64/1) + 10  == 2**64
    True

    Pyhton 2: https://ideone.com/iqwl8L
    Pyhton 3: https://ideone.com/ltG9Fq

    Ну охуеть теперь.
    x + 10 - 10 != x в общем случае - это норма?
    Я всё понимаю - тяжёлое детство, инты, прибитые к железу, но на кой чёрт в современных интерпретируемых языках такое говнище?

    3.14159265, 13 Марта 2018

    Комментарии (30)
  7. Куча / Говнокод #23504

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    https://hi-tech.mail.ru/news/facebook-send-nudes/
    
    "Facebook" тестирует систему распознавания фотографий пикантного содержания с их последующим
    удалением, и в рамках тестирования умоляет пользователей отправить самим себе предметы боди-арта.
    Так что можете наконец извлечь из смартфонов любовно разглядываемые холодными осенними вечерами
    фотографии ваших анальных отверстий и пустить их на развитие искусственного интеллекта.

    AnalPerOral, 08 Ноября 2017

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

    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
    function string_cleaner($data, array $opts) //1: Массив или строка, 2: Только массив
    	{
    		
    		if (empty($opts))
    		{
    			$opts['null_byte'] = TRUE;
    		}
    		
    		$null_byte = ($opts['null_byte'] == 'off')
    			? FALSE
    			: TRUE;
    		
    		$opts_allowed = ['trim', 'htmlspecialchars', 'strip_tags', 'addslashes', 'htmlentities'];
    		
    		$opts = array_intersect_key($opts, array_flip($opts_allowed));
    		
    		if(is_array($data))
    		{
    			foreach($data as $key => &$value)
    			{
    				if(is_array($value))
    				{
    					string_cleaner($value, $opts);
    				}
    				
    				if ($null_byte)
    				{
    					$value = str_replace(chr(0), '', $value);
    				}
    				
    				if(is_array($opts))
    				{
    					foreach($opts as $clear_func => $clear_func_params)
    					{
    						$value = (!$clear_func_params) ? $clear_func($value) : $clear_func($value, $clear_func_params);
    					}
    				}
    			}
    		}
    		else
    		{
    			if ($null_byte)
    			{
    				$data = str_replace(chr(0), '', $data);
    			}
    			
    			if(is_array($opts))
    			{
    				foreach($opts as $clear_func => $clear_func_params)
    				{
    					$data = $value = (!$clear_func_params) ? $clear_func($data) : $clear_func($data, $clear_func_params);
    				}
    			}
    		}
    		
    		return $data;
    		
    	}
    
    {...}
    
    	$server['get'] = string_cleaner($_GET, ['trim'=>' ', 'htmlentities'=>'', 'strip_tags'=>'', 'addslashes'=>'']);

    Для сука ленивых

    Intention, 30 Октября 2017

    Комментарии (30)
  9. bash / Говнокод #23372

    −3

    1. 1
    А вы замечали, что пари предпросмотре поста выводится дата "01 Января 1970"?

    d_fomenok, 28 Сентября 2017

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

    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
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    // check that all selected vertices are one 3d vertex.
      bool UsedIndex = 0;
      bool IndexIsRegistered = false;
      for (int t = 0; t < Indices.count(); t++)
      {
        zUVVertex Vertex = OldVerts->at(t);
        if (!IndexIsRegistered)
        {
          IndexIsRegistered = true;
          UsedIndex = Vertex.BaseVertexIndex;
        }
        else if (UsedIndex != OldVerts->at(t).BaseVertexIndex)
        {
          // quit on fail
          return;
        }
      }
      NewList = new QList<zUVVertex>();
    
      zUVVertex NewVertex;
      bool VertexIsInitialized = false;
      bool CapIsHoled = false;
    
      for (quint32 t = 0; t < OldVerts->count(); t++)
      {
        bool Taked = false;
        for (quint32 j = 0; j < Indices.count(); j++)
        {
          if (OldVerts->at(t).index == Indices.at(j))
          {
            if (!VertexIsInitialized)
            {
              VertexIsInitialized = true;
              NewVertex = OldVerts->at(t);
            }
            Taked = true;
            NewVertex.IndicesBeforeWeld << t;
            break;
          }
        }
        if (!Taked)
        {
          (*NewList) << OldVerts->at(t);
        }
        else
        {
          zUVVertex Stub;
    
          if (!CapIsHoled)
          {
            Stub = NewVertex;
          }
          else
          {
            Stub.Index = 0x7FFFFFFF;
          }
          (*NewList) << Stub;
        }
      }
      (*NewList) << NewVertex;
    
      Taked = false;
      QList<zUVFace> *TempFacesList = new QList<zUVFace>();
    
      for (int t = 0; t < Faces->count(); t++)
      {
        zUVFace Face = Faces->at(t);
        zUVFace NewFace;
        for (int j = 0; j < Face.VertsIndices; j++)
        {
          quint32 Index0 = Face.VertsIndices.at(j);
          zUVVertex TestVertex = NewList->at(Index0);
          if (TestVertex.Index == 0x7FFFFFFF)
          {
            // need to replace
            NewFace = Faces->at(t);
            NewFace.VertsIndices.operator [](j) = NewList->count() - 1;
            Taked = true;
          }
        }
        if (Taked)
        {
          (*TempFacesList) << NewFace;
        }
      }

    http://www.gamedev.ru/code/forum/?id=216701

    gammaker, 25 Июля 2016

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

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    auto getMaxSize = [](const auto &vec) {
        if (vec.size() == 0)
            return 0;
        const auto &max = *std::max_element(
                    vec.begin(),
                    vec.end(),
                    [](const auto &lhs, const auto &rhs){
            return lhs.size() < rhs.size();
        });
        return max.size();
    };

    Раньше я не понимал актуальность шутки:
    In C++14, you just write auto auto(auto auto) { auto; } The compiler infers the rest from context

    Antervis, 23 Июня 2016

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