1. PHP / Говнокод #1378

    +152

    1. 1
    2. 2
    3. 3
    $n = count($arts) * $destruct_p;
       $p = $n - floor(n);
       $n = floor(n);

    кодим без E_NOTICE

    guest, 16 Июля 2009

    Комментарии (1)
  2. JavaScript / Говнокод #1377

    +143.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
    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
    function setdata()
    {  
    if(document.sunform.town.value == "spb")
       { 
         document.sunform.longitude.value = 30;
         document.sunform.longmin.value = 15;
         document.sunform.latitude.value = 60;
         document.sunform.latmin.value = 00;
         document.sunform.zone.value = +3;
       }
       
       if(document.sunform.town.value == "gbr")
       { 
         document.sunform.longitude.value = 9;
         document.sunform.longmin.value = 56;
         document.sunform.latitude.value = 53;
         document.sunform.latmin.value = 34;
         document.sunform.zone.value = +1;
       }
       
       if(document.sunform.town.value == "msk")
       { 
       ...
       }
       
       if(document.sunform.town.value == "mur")
       { 
       ...
       }
    
       if(document.sunform.town.value == "kiev")
       { 
       ...
       }
    
       if(document.sunform.town.value == "minsk")
       { 
       ...
       }
    
       if(document.sunform.town.value == "soshi")
       { 
       ...
       }
    
       if(document.sunform.town.value == "nn")
       { 
       ...
       }
    
    
       if(document.sunform.town.value == "kazan")
       { 
       ...
       }
    
       if(document.sunform.town.value == "ekb")
       { 
       ...
       }
    
       if(document.sunform.town.value == "novosib")
       { 
       ...
       }
    }

    Кусок скрипта для рассчета времени восхода и захода Солнца.
    Стырено с www.astrotime.ru
    Вместо ... аналогичные присваивания, только с другими числами.

    guest, 16 Июля 2009

    Комментарии (10)
  3. JavaScript / Говнокод #1376

    +146

    1. 1
    2. 2
    3. 3
    4. 4
    function refreshPage() {
     //alert(document.location);
     document.location = document.location;
    }

    Стырена с моего мира mail.ru

    guest, 16 Июля 2009

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

    +131.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    class Par_host_port
    {
    private:
            std::string vdata;
    public:
    //...
            char* get () { return (char*)vdata.c_str (); }
    };

    char const* превращается... Превращается char const*... В char*!

    guest, 15 Июля 2009

    Комментарии (7)
  5. SQL / Говнокод #1374

    −131.5

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    SELECT   [Worker_list].[Id]                       ,
             [Worker_list.Post_adress]                ,
             [Worker_list.Ident_fiscal]               ,
             [Worker_list.VacationDay]                ,
             [Worker_list].[Name_worker]              ,
             [Worker_list].[Name]                     ,
             [Worker_list].[Firstname]                ,
             [Worker_list].[Middlenamme]              ,
             [Worker_list].[Табельний номер]          ,
             [Worker_list].[workfrom] AS workfromtable,
             (SELECT MIN([time_list].[begin_date])
             FROM    [time_list]
             WHERE   [time_list].[worker]=[worker_list].[id]
             ) AS accountfrom,
             IIF
             (
                      ISNULL([workfromtable]),[accountfrom],[workfromtable]
             )                              AS workfrom           ,
             [Worker_list].[startstockdate] AS startstockdatetable,
             IIF
             (
                      ISNULL([startstockdatetable]),[accountfrom],[startstockdatetable]
             )                               AS startstockdate      ,
             [Worker_list].[startaccrualday] AS startaccrualdaytable,
             [Worker_list].[startusedday]    AS startuseddaytable   ,
             IIF
             (
                      ISNULL([startaccrualdaytable]),0,[startaccrualdaytable]
             ) AS Startaccrualday,
             IIF
             (
                      ISNULL([startuseddaytable]),0,[startuseddaytable]
             ) AS startusedday,
             (SELECT MIN([calendar_all].[Дата])
             FROM    calendar_all
             )                                                                       AS Todayis          ,
             SUM(DATEDIFF("d",[Chas]![Date Begin],DATEADD("d",1,[Chas]![Date end]))) AS UsedDayAfterTable,
             IIF
             (
                      ISNULL([useddayaftertable]),0,[useddayaftertable]
             ) AS UsedDayAfter,
             (SELECT SUM (DATEDIFF("d",Chas.[Date Begin], DATEADD("d",1,Chas.[Date End])))
             FROM    Worker_list AS Worker_list_1
                     INNER JOIN (Reason_list
                             INNER JOIN Chas
                             ON      Reason_list.Id = Chas.Reason)
                     ON      Worker_list_1.Id       = Chas.Worker
             WHERE   Reason_list.List               =0
                 AND Worker_list.Id                 =Worker_List_1.Id
                 AND chas.[date end]               <=
                     (SELECT MIN([calendar_all].[Дата])
                     FROM    calendar_all
                     )
             ) AS timelossafterbeforetable,
             (SELECT SUM (DATEDIFF("d",Chas.[Date Begin], DATEADD("d",1,
                     (SELECT MIN([calendar_all].[Дата])
                     FROM    calendar_all
                     ))))
             FROM    Worker_list AS Worker_list_1
                     INNER JOIN (Reason_list
                             INNER JOIN Chas
                             ON      Reason_list.Id = Chas.Reason)
                     ON      Worker_list_1.Id       = Chas.Worker
             WHERE   Reason_list.List               =0
                 AND Worker_list.Id                 =Worker_List_1.Id
                 AND chas.[date begin]              <
                     (SELECT MIN([calendar_all].[Дата])
                     FROM    calendar_all
                     )
                 AND chas.[date end] >
                     (SELECT MIN([calendar_all].[Дата])
                     FROM    calendar_all
                     )
             ) AS timelossaftertable,
             IIF
             (
                      ISNULL([timelossafterbeforetable]),0,[timelossafterbeforetable]
             ) AS timelossafterbefore,
             IIF
             (
                      ISNULL([timelossaftertable]),0,[timelossaftertable]
             )                                                                              AS timelossafter,
             DATEDIFF("d",[startstockdate],[todayis])-[timelossafterbefore]-[timelossafter] AS workoffafter ,
             INT([workoffafter]                      /365*
             IIF
             (
                      ISNULL([Worker_list].[VacationDay]),GetVacationDayCount(),[Worker_list].[VacationDay]
             )
             )                                                   AS accrualdayafter,
             DATEDIFF("d",[workfrom],[todayis])                  AS workoffall     ,
             [Startaccrualday]        -[startusedday]+[accrualdayafter] AS accrualdayall  ,
             [accrualdayafter]        +[startaccrualday]                AS accrualday     ,
             [startusedday]           +[useddayafter]-StateHoliDay      AS usedday        ,
             [accrualday]             -[usedday]                        AS unusedday      ,
             DATEADD("d",INT([usedday]/
             IIF
             (
                      ISNULL([Worker_list].[VacationDay]),GetVacationDayCount(),[Worker_list].[VacationDay]
             )
             *365)+[timelossafterbefore]+[timelossafter],[workfrom]) AS Usedto,

    Запрос количества оставшихся отпусков в кадровой программе

    guest, 14 Июля 2009

    Комментарии (9)
  6. PHP / Говнокод #1373

    +147

    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
    // (C) Cody Mays <[email protected]> All Rights Reserved. BSD License
    require_once('Auth/OpenID/DatabaseConnection.php');
    require_once("Auth/OpenID/FileStore.php");
    
    class OpenIDSystem
    {
    	private $consumer;
    	private $response;
    	private $callbacks;
    	
    	public function __construct()
    	{
    		$this->consumer = false;
    		$this->response = false;
    		$this->callbacks = false;
    	}

    один из кандидатов на роль либы для работы с openID

    guest, 14 Июля 2009

    Комментарии (1)
  7. JavaScript / Говнокод #1372

    +152

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function allowCheckout(enable) {
        if (enable)
            $("#btnMakeOrder").removeAttr("enabled");
        else
            $("#btnMakeOrder").removeAttr("disabled");
    }

    Код, который написал бельгийский Software Architect, пришедший из мира C++ говонокодинга.
    Дальше будет...

    guest, 14 Июля 2009

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

    +149

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    <xsl:template match="/ | @* | node()">
        <xsl:if test="local-name()='item'">
          <itemname>
            <xsl:value-of select="node()"/>
          </itemname>
        </xsl:if>
        <xsl:if test="local-name()!='item'">
          <xsl:copy>
            <xsl:apply-templates select="@* | node()" />
          </xsl:copy>
        </xsl:if>
    </xsl:template>

    guest, 14 Июля 2009

    Комментарии (1)
  9. PHP / Говнокод #1370

    +149

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <xsl:template match="/ | @* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()" />
        </xsl:copy>
    </xsl:template>

    guest, 14 Июля 2009

    Комментарии (1)
  10. PHP / Говнокод #1369

    +148

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <xsl:template name="a">
        <xsl:for-each select="//item">
          <megaitem>
            <xsl:value-of select="node()"/>
          </megaitem>
        </xsl:for-each>
      </xsl:template>

    guest, 14 Июля 2009

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