- 1
- 2
- 3
$n = count($arts) * $destruct_p;
$p = $n - floor(n);
$n = floor(n);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+152
$n = count($arts) * $destruct_p;
$p = $n - floor(n);
$n = floor(n);
кодим без E_NOTICE
+143.2
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
Вместо ... аналогичные присваивания, только с другими числами.
+146
function refreshPage() {
//alert(document.location);
document.location = document.location;
}
Стырена с моего мира mail.ru
+131.8
class Par_host_port
{
private:
std::string vdata;
public:
//...
char* get () { return (char*)vdata.c_str (); }
};
char const* превращается... Превращается char const*... В char*!
−131.5
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,
Запрос количества оставшихся отпусков в кадровой программе
+147
// (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
+152
function allowCheckout(enable) {
if (enable)
$("#btnMakeOrder").removeAttr("enabled");
else
$("#btnMakeOrder").removeAttr("disabled");
}
Код, который написал бельгийский Software Architect, пришедший из мира C++ говонокодинга.
Дальше будет...
+149
<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>
+149
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
+148
<xsl:template name="a">
<xsl:for-each select="//item">
<megaitem>
<xsl:value-of select="node()"/>
</megaitem>
</xsl:for-each>
</xsl:template>