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

    В номинации:
    За время:
  2. 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)
  3. 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)
  4. Куча / Говнокод #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)
  5. 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)
  6. bash / Говнокод #23372

    −3

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

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

    Комментарии (30)
  7. 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)
  8. 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)
  9. C# / Говнокод #19545

    +6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    using System;
    namespace Colculator
    {
        public partial class Form1 : Form
        {
               bool BOOL = {
                     true,true,true,true,true,true,true,false};
               if(BOOL(new Random(1,8)){
                          Consosle.WriteLine("ДА");
    }

    Так делать нельзя!!!

    sliper, 28 Февраля 2016

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

    +10

    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
    template <int N> void f(int v)
    {
        (void *)v;
    }
    
    int main()
    {
        int s = 123;
        int k = 1234;
        
        f<11>(k);
        s<11>(k);
        
        return 0;
    }

    Плюсы, такие плюсы.

    CriDos, 07 Декабря 2015

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

    +3

    1. 1
    Вышел php-7.0.0!

    Возрадуемся, обсудим?

    Bobik, 02 Декабря 2015

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