- 1
@$go = (string)$_HTTP_REQUEST_VARS['go'];
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+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?!
До моего прихода на фирму все пользовались выше приведенным кодом! (и много еще чем!)
+71.6
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.Display;
public class BIOS extends MIDlet{
Kernel kern;
boolean in=false;
public void pauseApp(){
kern.c.println("ACPI : Macine paused");
}
public void destroyApp(boolean b){
kern.c.println("ACPI : Macine poweroffing");
exitApp(true);
}
public void startApp(){
if(!in) kern=new Kernel(this);
else kern.c.println("ACPI : Machine resumed");
in=true;
}
public void exitApp(boolean physical){
Display.getDisplay(this).setCurrent(kern.c);
kern.c.println("Changing runlevel to 0... [Ok]");
kern.c.println("Sending to processes the TERM signal");
kern.c.println("Sending to processes the KILL signal");
kern.c.println("Stopping FS: fsdriver");
kern.fs=null;
kern.c.println("Sending the system clocktime...");
try{
Thread.currentThread().sleep(5000L);kern.c.println("Destroyed.");
Thread.currentThread().sleep(500L);System.gc();}catch(Exception e){}
in=false;
if(physical) notifyDestroyed();
}
}
Очередной кусок говнокода :)
+73.3
package xx.xxxxxxxx.xxx.xxx.gui.constants;
/**
* constants.
*/
public class Constants
{
public static final int HORIZONTAL_SIZE = 500;
public static final int VERTICAL_SIZE = 340;
public static final int ABS_MAX_LENGTH_NUMBER = 28;
public static final int ZERO = 0;
public static final int ONE = 1;
public static final int TWO = 2;
public static final int THREE = 3;
public static final int FOUR = 4;
public static final int FIVE = 5;
}
ZERO=0, ONE=1, TWO=2, ...
Ваш К.О.
+143.8
News news = new News();