- 1
ViewState["Action"] = result.client == "merchantName" ? false : true;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+145.4
ViewState["Action"] = result.client == "merchantName" ? false : true;
+159.3
var res_html = "";
for (var i = 0; i < title_section.length; i++)
{
if (title_section[i].id == sel) {
res_html += '<div class="'+prefix+'section_title" onmouseover="section_sel(this,\''+ prefix +'\')" onmouseout="section_unsel(this,\''+ prefix +'\')"' +
'onclick="section_choise(this,'+'\''+url+'\'' + ')"' +
'id='+'"'+title_section[i].id+'" '
+'style='+'"font-weight: bold"'+'>'+
'<span class="'+ prefix +'dashed_anchor">' + title_section[i].name + '</span> ';
// res_html += '(' + number_section[i] + ')';
res_html += '</div>';
}
else{
res_html += '<div class="'+prefix+'section_title" onmouseover="section_sel(this,\''+ prefix +'\')" onmouseout="section_unsel(this,\''+ prefix +'\')"' +
'onclick="section_choise(this,'+'\''+url+'\'' + ')"' +
'id='+'"'+title_section[i].id+'" '
+'>'+
'<span class="'+ prefix +'dashed_anchor">' + title_section[i].name + '</span> ';
// res_html += '(' + number_section[i] + ')';
res_html += '</div>';
}
}
document.getElementById(prefix + "sections").innerHTML += res_html;
document.getElementById(prefix + "sections").innerHTML += '<a href='+'"?id=all"'+'><div class="'+prefix+'all_sections"><img src="media/img/01/arrow.jpg" alt=""/>' +
'<span style="color:black">Все разделы</span> </div></a>';
document.getElementById(prefix + "column_sections").style.width = (max_length + 7) + "ex";
/* document.getElementById(prefix + "green_sector").style.height = (document.getElementById(prefix + "column_other").offsetHeight - 14) + "px";*/
}
Яваскрипт от местного умельца:)
+167.8
date_in.date_ >= '".date("Y")."-".date("m")."-".date("d")."'
кусок SQL запроса...
+151.5
@$go = (string)$_HTTP_REQUEST_VARS['go'];
+160.9
static function &getdbHandler(){
global $DB_tree;
return $DB_tree;
}
Shop-Script поражает....
+157.6
$('.i18n').each(function() {
//здесь заменяем для всех i18n на значение поля по умолчанию среди полей его класса
$('.' + $(this).attr('id').substr(0, parseInt(($(this).attr('id')).length - <?php echo strlen(c('locale.default')) ?>))).val($('#' + $(this).attr('id').substr(0, parseInt(($(this).attr('id')).length - <?php echo strlen(c('locale.default')) ?>)) + '_<?php echo c('locale.default') ?>').val());
});
+133.3
<target name="test-boolean">
<condition property="if-true" value="true" else="false">
<!--
Попробуйте попереключайте true / false
и посмотрите на результат - вам однозначно понравится :)
-->
<istrue value="false"/>
</condition>
<antcall target="test-boolean-true"/>
<antcall target="test-boolean-false"/>
</target>
<target name="test-boolean-true" if="if-true">
<echo>The condition evaluates to "true"</echo>
</target>
<target name="test-boolean-false" unless="if-true">
<echo>The condition evaluates to "false"</echo>
</target>
Язык - Ant, для тех, кто не в курсе. Я думаю, можно спокойно зачислить в говноязыки.
+168.1
var rus = new String("йцукенгшщзфывапролдячсмитьЙЦУКЕНГШЩЗФЫВАПРОЛДЯЧСМИТЬ");
var eng = new String("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM");
for (var i in rus) {
reg = new RegExp(rus[i], 'g');
pass = pass.replace(reg, eng[i]);
}
Конвертация русских чаров в английские в соответствии с расположением на клаве. Зачем - не суть важно. Регулярки! Десятки их! Полсотни итераций для простой замены русских букв на английские!
+159.3
switch ($_SERVER['QUERY_STRING'])
{
case "comments":
$content = $_POST['addcomment'] ? $cmt->process_addcomment() : $this->main_comments($_GET['id']);
break;
Нашел в очередной cms.
+108.7
Function GetFmtTime:String;
var
tmpD : string;
crdate: TDateTime;
begin
crdate := Now;
tmpD := IntToStr(YearOf(crdate))+'-';
If MonthOf(crdate)<10 Then tmpD := tmpD + '0';
tmpD := tmpD + IntToStr(MonthOf(crdate))+'-';
If DayOf(crdate)<10 Then tmpD := tmpD + '0';
tmpD := tmpD + IntToStr(DayOf(crdate))+'(';
If HourOf(crdate)<10 Then tmpD := tmpD + '0';
tmpD := tmpD + IntToStr(HourOf(crdate)) + '-';
If MinuteOf(crdate)<10 Then tmpD := tmpD + '0';
tmpD := tmpD + IntToStr(MinuteOf(crdate)) + '-';
If SecondOf(crdate)<10 Then tmpD := tmpD + '0';
tmpD := tmpD + IntToStr(SecondOf(crdate)) + ')';
Result := tmpD;
end;
А почему бы не использовать обычную FormatDateTime?!
До моего прихода на фирму все пользовались выше приведенным кодом! (и много еще чем!)