- 1
- 2
- 3
if (typeof window.$lab === 'undefined') {
document.write('<script type="text/javascript">var $lab = jQuery.noConflict(true);\x3C/script>');
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+143
if (typeof window.$lab === 'undefined') {
document.write('<script type="text/javascript">var $lab = jQuery.noConflict(true);\x3C/script>');
}
потому что eval - зло
P.s. \x3C/script> - такая запись ибо впилено тегом скрипт в head
+158
if ($qproizv_r->s > 0 && $qpriem_n > 0) {
if ($qproizv_r->s >= $row->Kol) {
$Status = 6;
}
} else {
if ($qpriem_n > 0) {
$Status = 6;
}
}
Так и живем.
+82
Boolean hasRefId = !node.getAttributes().getNamedItem("refid").equals(null);
equals(null)
+76
function returnUserId() {
if (document.getElementById('userstap') != null ) {
var obj = document.getElementById('userstap');
<% if ((sUserIdForPrint != null) && !sUserIdForPrint.equals("")) {%>
if (obj.options[obj.selectedIndex].value == 0) {
return "<%=sUserIdForPrint%>";
<% } %>
<% if (((sAccGrpUserIdForPrint != null) && !sAccGrpUserIdForPrint.equals("")) && ((sUserIdForPrint != null) && !sUserIdForPrint.equals(""))) {%>
} else if (obj.options[obj.selectedIndex].value == 1 ) {
return "<%=sAccGrpUserIdForPrint%>";
<% } else if ((sAccGrpUserIdForPrint != null) && !sAccGrpUserIdForPrint.equals("")){%>
if (obj.options[obj.selectedIndex].value == 1 ) {
return "<%=sAccGrpUserIdForPrint%>";
<% } %>
<% if (((sAccGrpUserIdForPrint != null) && !sAccGrpUserIdForPrint.equals("")) || ((sUserIdForPrint != null) && !sUserIdForPrint.equals(""))) {%>
} else if (obj.options[obj.selectedIndex].value == 2) {
return "<%=userId%>";
}
<% } else {%>
if (obj.options[obj.selectedIndex].value == 2) {
return "<%=userId%>";
}
<% } %>
} else {
return "<%=userId%>";
}
}
Любите ли вы JSP так, как люблю его я?
+155
<?php
/**
* Get category tree.
*
* @param db $db
* @return array
*/
function getCategoryTree ($db) {
$query = $db->query('SELECT * FROM dle_category ORDER BY posi');
if ($query->num_rows <= 0) {
return FALSE;
}
$categories = $query->fetch_all(MYSQLI_ASSOC);
$tree = array();
foreach ($categories as $cat) {
if ($cat['parentid'] == '0') {
$tree[$cat['id']] = $cat;
}
else {
$tree[$cat['parentid']]['subcategories'][] = $cat;
}
}
return $tree;
}
/**
* Display categories.
* Sorry for my french 'echo'.
*
* @param array $category
*/
function displayCategory ($category) {
$html = '';
foreach ($category as $cat) {
$html .= '<li class="lonely "><a href="/">' . $cat['name'] . '</a>';
if ($cat['subcategories']) {
$html .= '<span class="accordion"></span><ul>';
$html .= displayCategory ($cat['subcategories']);
$html .= '</ul>';
}
$html .= '</li>';
}
return $html;
}
// Getting categories
$categories = getCategoryTree($db);
if ($categories) {
echo displayCategory ($categories);
}
else {
echo '<li>Нету категорий</li>';
}
Мой говно модуль для DLE для отображения дерева категорий в меню.
Почему DLE разработчики не могли это из коробки сделать? И почему там куча говнокода внутри? (на Англ. комментарии потому что привык)
+140
@foreach (var groupTest in Model.Select(t => t.TestType).Distinct())
{
<div class="form-column form-column2">
<div class="static-height">
<p class="content-subblock-title left upper-text">
<label>
@if (@groupTest.GetEnumDescription().Length < 34)
{
<text> </text>
}
@groupTest.GetEnumDescription()
</label>
</p>
@foreach (var item in Model.Where(t => t.TestType == groupTest).OrderBy(t => t.Order))
{
<div class="donation-row">
<label>@item.TestName</label>
<span class="@item.TestClass blood-test-value-don">
@item.TestValue
</span>
</div>
}
</div>
</div>
}
Я пялюсь на этот кусок вот уже полчаса...
+135
if ((Mathf.Abs(_mouseOverX) > 0.2f || Mathf.Abs(_mouseOverY) > 0.2f))
{
switch (selecetedItemIndex)
{
case -1 :
var a = Mathf.Atan2(_mouseOverX, _mouseOverY) * Mathf.Rad2Deg;
a += angle / 2.0f;
if (a < 0) a = a + 360.0f;
index = (int)(a / angle);
break;
case 0:
var a0 = Mathf.Atan2(_mouseOverX, _mouseOverY) * Mathf.Rad2Deg;
a0 += angle / 2.0f;
if (a0 < 0) a0 = a0 + 360.0f;
index = (int)(a0 / angle);
switch (index)
{
case 5 :
index = 7;
break;
case 6:
index = 7;
break;
case 4 :
index = -1;
break;
case 3:
index = 1;
break;
case 2:
index = 1;
break;
}
break;
case 1:
var a1 = Mathf.Atan2(_mouseOverX, _mouseOverY) * Mathf.Rad2Deg;
a1 += angle / 2.0f;
if (a1 < 0) a1 = a1 + 360.0f;
index = (int)(a1 / angle);
switch (index)
{
case 0 :
index = 0;
break;
case 7:
index = 0;
break;
case 6 :
index = -1;
break;
case 5:
index = -1;
break;
case 4:
index = 3;
break;
case 3:
index = 3;
break;
case 2:
index = 2;
break;
}
break;
case 2:
var a2 = Mathf.Atan2(_mouseOverX, _mouseOverY) * Mathf.Rad2Deg;
a2 += angle / 2.0f;
if (a2 < 0) a2 = a2 + 360.0f;
index = (int)(a2 / angle);
switch (index)
{
case 0: index = 1; break;
case 7: index = 1; break;
case 6: index = -1; break;
case 5: index = 3; break;
case 4: index = 3; break;
}
break;
case 3:
var a3 = Mathf.Atan2(_mouseOverX, _mouseOverY) * Mathf.Rad2Deg;
a3 += angle / 2.0f;
if (a3 < 0) a3 = a3 + 360.0f;
index = (int)(a3 / angle);
switch (index)
Radial menu govnokod style
+135
function e(id){ return document.getElementById(id); }
Бредогенерации тред.
+53
// quick render params menu actions
if(pe->buttons()&Qt::LeftButton || pe->buttons()&Qt::RightButton){
//
if(cRenderMenuOpended){//
if((p.x()+p.y())<18){// - -
cRenderMenuOpended=!cRenderMenuOpended;
repaint();
return;
}
else if(p.x()>5 && p.y()>5 && p.x()<145 && p.y()<cRenderMenuHeight){// actions rectangle
//
//sliceModifyMode=true; // show slice plane and can be modified
//useSlicePlane=true; // build geometry with slice plane
if(cViewType==0){// 2D
if(p.x()>10 && p.y()>22 && p.x()<140 && p.y()<38){
// reset zoom
if(c2DZoom1To1){
cPanFor2DX1to1=0;
cPanFor2D=0;
cPanFor2DX=0;
cZoomFor2D=1;
if(cViewType==0 && c2DZoom1To1 && renderLimits){
auto testSizeX=cVieportXSize;
auto testSizeY=cVieportYSize;
BoundaryConditionsOfComposite *cond=NULL;
cond=AbstractContainer::getInstance()->getBoundaryCondition(0);
if(cond->isHeatFlux_multiple()){
cPanFor2D+=15;
testSizeY-=20;
}
if(cond->isHeatFlux_multiple() || cond->isHeatFlux() || cond->isHeatPower() || cond->isConvection() || cond->isInsulated() || cond->isTemperature()){
cPanFor2D+=20;
testSizeY-=25;
}
cond=AbstractContainer::getInstance()->getBoundaryCondition(3);
if(cond->isHeatFlux() || cond->isHeatPower() || cond->isConvection() || cond->isInsulated() || cond->isTemperature()){
testSizeX-=35;
cPanFor2DX1to1+=30;
}
cond=AbstractContainer::getInstance()->getBoundaryCondition(1);
if(cond->isHeatFlux() || cond->isHeatPower() || cond->isConvection() || cond->isInsulated() || cond->isTemperature()){
testSizeX-=35;
}
if(cWidth>cThikness){
cZoomFor2D=(double(testSizeX)-50.0)/(zoomed2DX(width_sub_start)-zoomed2DX(width_sub_end));
}
else{
cZoomFor2D=(double(testSizeY)-50.0)/(zoomed2DY(thickness_sub_start)-zoomed2DY(thickness_sub_end));
}
}
}
else{
cZoomFor2D=1;
cPanFor2D=0;
cPanFor2DX=0;
}
repaint();
return;
}
else if(p.x()>10 && p.y()>42 && p.x()<140 && p.y()<58){
cForbidRenderResultsOverLayers=!cForbidRenderResultsOverLayers;
repaint();
return;
}
else if(p.x()>10 && p.y()>62 && p.x()<140 && p.y()<78){
renderLimits++;
if(renderLimits>1){
renderLimits=0;
}
repaint();
return;
}
else if(p.x()>10 && p.y()>82 && p.x()<140 && p.y()<98){
SLOT_swap2DMode11AndScaled();
return;
}
else if(p.x()>106 && p.y()>92 && p.x()<122 && p.y()<118){
cResTransparency-=0.1;
if(cResTransparency<0){cResTransparency=0;}
repaint();
return;
}
else if(p.x()>124 && p.y()>92 && p.x()<140 && p.y()<118){
cResTransparency+=0.1;
if(cResTransparency>1){cResTransparency=1;}
repaint();
return;
}
}
else{//3D
if(p.x()>10 && p.y()>22 && p.x()<140 && p.y()<38){
slot_swapCoordiantes();
return;
}
else if(p.x()>10 && p.y()>42 && p.x()<140 && p.y()<58){
Магия чисел в построении GUI
+51
QVector<double*>*** ElemBoundCond = tbc->getElementsBC();
QVector<double*>* preNodalVals = tbc->getPreNodalValues();
QVector<double*>* nodalForces = tbc->getNodalForces();
long elems = grid->getElemsNumber();
long nodes = grid->getNodesNumber();
long** Elements = grid->getElems();
double** Nodes = grid->getNodes();
long* ElemMaters = grid->getElemsMaterials();
long NBW = grid->getBandWidth();
emit signal_addLineToCalculationProtocol(">>> Solve heat problem ");
long NS[4],//+numbers of 4 nodes
NCL = 1,//number or unknown values per node (1 for thermal analysis)
ni, nj, nk,//face nodes
gnN, dN;
double ESM[4][4],//+element stiffness matrix
EF[4],//+element force matrix
**C,//matrix conteins X, Y, Z coordinates, rows like |1 Xi Yi Zi|
**CA,//conteins columns like |ai bi ci di|
//*GF,//band matrix, pointers to Global Force and Global Sriffness Matrices in A
V36,//+hexa and 36 element volume
S_3,//face area div 3
hS_3, hS_6, hS_12,//h * face area div 6 and div 12
hST_3,//h * face area * T / 3
qS_3;//q * face area / 3
QVector<double*>* fcond;
MaterialsDatabase* matdb = MaterialsDatabase::getInstance();
double Kxx, Kyy, Kzz;//thermal condactivities in X, Y and Z axes
И снова фортранщина.