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

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

    +125

    1. 1
    2. 2
    $ find . -type f -name '*.asp' -exec grep -nHi 'select \*' {} \; | wc -l
    2160

    teh drama :(

    wvxvw, 06 Марта 2013

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

    +125

    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
    //сервер сайд (из colors.php)
    
    $colors = [
        'banana'   => 'yellow',
        'orange'   => 'orange',
        'cucumber' => 'green'
    ];
    
    echo $colors[$_GET['fruit']];
    
    
    //клиент сайд (js)
    var fruits = ['banana', 'orange', 'cucumber']
    for (var i in fruits) {
        var fruit = fruits[i]
        $.get('colors.php?fruit='+fruit, function(color){
            document.write(fruit +' is '+ color +'<br/>')
        })
    }

    Этот код показывают и задают вопрос почти на любом собеседовании на должность web-программита:
    Что здесь неверно и как это исправить?

    LispGovno, 02 Марта 2013

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

    +125

    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
    class OneAtATimePlease
      {
        private static object lok = new object();
    
        static void Main()
        {
          Dictionary<int, string> d = new Dictionary<int, string>();
          Thread t = new Thread(new ParameterizedThreadStart(Fill));
          Thread t2 = new Thread(new ParameterizedThreadStart(Fill));
          t.Start(d);
          t2.Start(d);
          t.Join();
          t2.Join();
          foreach (var i in d)
          {
            Console.WriteLine(i.Key + " " + i.Value);
          }
        }
    
        public static void Fill(object lo)
        {
          Dictionary<int, string> d = (Dictionary<int, string>)lo;
    
          for (int i = 0; i < 10; i++)
          {
            Random r = new Random(i*4);
            int v = r.Next(0, 10);
            if (!d.ContainsKey(v))
            {
              lock (lok)
              {
                d.Add(v, "Hello from thread: " + Thread.CurrentThread.ManagedThreadId);
              }
            }
          }
        }
      }

    taburetka, 25 Февраля 2013

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

    +125

    1. 1
    2. 2
    3. 3
    4. 4
    void get_me(const char **retval)
    {
        *retval = "Hello, Word!";
    }

    Надейся на компилятор...

    Novi4oK, 16 Февраля 2013

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

    +125

    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
    <ul class="select"><li><a href="#nogo"><b>Clients</b><!--[if IE 7]><!--></a><!--<![endif]-->
            <!--[if lte IE 6]><table><tr><td><![endif]-->
            <div class="select_sub">
                <ul class="sub">
                    <li><a href="#nogo">Clients Details 1</a></li>
                    <li><a href="#nogo">Clients Details 2</a></li>
                    <li><a href="#nogo">Clients Details 3</a></li>
                 
                </ul>
            </div>
            <!--[if lte IE 6]></td></tr></table></a><![endif]-->
            </li>
            </ul>

    Год выпуска неизвестен, но попалось сегодня....

    nonamez, 07 Февраля 2013

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

    +125

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    EnumChildWindows function (Windows)
    ...
    Return value
    Type: BOOL
    The return value is not used.

    Никому не нужный бул. Неужели нельзя было написать The return value is TRUE, раз юзать void религия не позволяет?
    Пруф: http://msdn.microsoft.com/library/windows/desktop/ms633494.

    bormand, 31 Января 2013

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

    +125

    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
    <!-- ... -->
    </body>
    </html><noindex>
    <table id="c_add2" name="c_add2" cellpadding="0" cellspacing="0" class="sh0"><tr><td><br></td></tr></table>
    <table id="c_add" name="c_add" cellpadding="0" cellspacing="0" class="sh0 clcart ft11">
    <tr>
    <td width="100%" height="27px" class="c_h"><strong class="fs72">Товар добавлен в корзину</strong></td>
    </tr>
    <tr>
    <td width="100%" height="90px">
    	<table width="100%" cellpadding="2" cellspacing="0" class="fs b fcgr">
    	<tr>
    		<td width="50%" align="right">Товаров в корзине: </td><td> <span id="c_cart" name="c_cart" class="fcz"></span></td>
    	</tr>
    	<tr>
    		<td width="50%" align="right">На сумму: </td><td> <span id="sum_cart" name="sum_cart" class="fcz"></span>&nbsp;р</td>
    	</tr>
    	</table>
    </td>
    </tr>
    <tr>
    <td width="100%" align="center" class="description">Окно будет закрыто через <span name="cl_time" id="cl_time">5</span> секунд</td>
    </tr>
    <tr>
    <td width="100%" align="center">
    <table width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="50%" align="center"><a href="cart.php"><img title="Перейти в корзину" alt="Перейти в корзину" src="img/btn/cartorder.gif" border="0"></a></td>
    <td width="50%" align="center"><a href="#" onclick="clTCart(); return false;"><img border="0" src="img/btn/closewin.gif"></a></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </noindex>

    I love my webmasterz!

    Stallman, 04 Января 2013

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

    +125

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    splitOn :: (a -> Bool) -> [a] -> [[a]]
    splitOn _ [] = []
    splitOn f xs = removeEmpty $ takeWhile (not . f) xs: splitOn f (dropWhile (f) $ dropWhile (not . f) xs) where
    	removeEmpty [] 	= []
    	removeEmpty (x:xs) 
    		| null x 	= removeEmpty xs 
    		| otherwise = x: removeEmpty xs
    
    words' :: String -> [String]
    words' = splitOn (flip elem " \n\r\f\t\v\160")

    Еще один words'

    Fai, 25 Ноября 2012

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

    +125

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    happy_numbers = [ tos (a,b,c,d,e,f a b c d e) | a <- [0..9], b <- [0..9], c <- [0..9], d <- [0..9], e <- [0..9], f a b c d e <= 9, f a b c d e >= 0 ]
    	where 
    		tos (a,b,c,d,e,f) = show a ++ show b ++ show c ++ show d ++ show e ++ show f
    		f a b c d e = a + b + c - d - e
    
    main = mapM print $ happy_numbers

    Fai, 11 Ноября 2012

    Комментарии (52)
  11. Куча / Говнокод #11755

    +125

    1. 1
    2. 2
    3. 3
    4. 4
    #include <beer>
    #include <autopilot>
    
    // C праздничком, говнокодеры

    istem, 12 Сентября 2012

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