1. Список говнокодов пользователя zerkms

    Всего: 3

  2. PHP / Говнокод #3504

    +161

    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
    class Kohana_Date {
    // ....
    
    	/**
    	 * Number of hours in a day. Typically used as a shortcut for generating a
    	 * list that can be used in a form.
    	 *
    	 *     $hours = Date::hours(); // 01, 02, 03, ..., 10, 11, 12
    	 *
    	 * @param   integer  amount to increment each step by
    	 * @param   boolean  use 24-hour time
    	 * @param   integer  the hour to start at
    	 * @return  array    A mirrored (foo => foo) array from start-12 or start-23.
    	 */
    	public static function hours($step = 1, $long = FALSE, $start = NULL)
    	{
    		// ... implementation
    	}
    
    	/**
    	 * Number of months in a year. Typically used as a shortcut for generating
    	 * a list that can be used in a form.
    	 *
    	 *     Date::months(); // 01, 02, 03, ..., 10, 11, 12
    	 *
    	 * @uses    Date::hours
    	 * @return  array  A mirrored (foo => foo) array from 1-12.
    	 */
    	public static function months()
    	{
    		return Date::hours();
    	}
    }

    Занятный способ сократить код, правда вносящий небольшую суматоху )

    zerkms, 18 Июня 2010

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

    +134.4

    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
    private void TestWorksheetFunction() 
    {
      ...
     
      Excel.WorksheetFunction wsf = ThisApplication.WorksheetFunction;
      ws.get_Range("Min", Type.Missing).Value2 = wsf.Min(rng, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing);
      ws.get_Range("Max", Type.Missing).Value2 = wsf.Max(rng, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing);
      ws.get_Range("Median", Type.Missing).Value2 = wsf.Median(rng,
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing);
      ws.get_Range("Average", Type.Missing).Value2 = wsf.Average(rng, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing);
      ws.get_Range("StDev", Type.Missing).Value2 = wsf.StDev(rng, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
        Type.Missing);
    }

    Если вы - разработчик на C#, вам придется привыкнуть к обилию значений Type.Missing в вызовах методов. Поскольку объектную модель Excel писали в расчете на VBA, многие ее методы принимают необязательные параметры - иногда до 30. Используйте либо многочисленные экземпляры значения Type.Missing или указывайте для каждого параметра определенное значение по умолчанию.
    (c) http://www.gotdotnet.ru/LearnDotNet/NETFramework/22054.aspx

    zerkms, 12 Октября 2009

    Комментарии (11)
  4. JavaScript / Говнокод #163

    +48

    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
    if ('Down' == 'Down')
    	{
    		//currentSeconds--;
    		currentSeconds = PromptTimer_StartCounter - correctionTime;
    		needTick = currentSeconds > 0;
    		if (!needTick)
    			currentSeconds = 0;
    	}
    	else
    	{
    		currentSeconds = PromptTimer_StartCounter + correctionTime;	
    		
    		if ('True' == 'False')
    		{
    			if (GetGMTOffsetInfo()[0] == "-")
    				currentSeconds += -(GetGMTOffsetInfo()[1] * 3600);
    			else 
    				currentSeconds += GetGMTOffsetInfo()[1] * 3600;
    		}
    		//currentSeconds++; 
    	}

    Код таймера на странице задания, проект "Энкаунтер" (http://en.cx)

    Posted by zerkms

    zerkms, 14 Декабря 2008

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