- 1
- 2
- 3
- 4
static function &getdbHandler(){
global $DB_tree;
return $DB_tree;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+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();
+162.4
$(document).ready(function(){
$("#dialog-a, #dialog-b, #dialog-c, #dialog-d, #dialog-e, #dialog-f, #dialog-g, #dialog-h, #dialog-i, #dialog-j, #dialog-k, #dialog-l, #dialog-m, #dialog-n, #dialog-o, #dialog-p, #dialog-q, #dialog-r, #dialog-s, #dialog-t, #dialog-u, #dialog-v, #dialog-w, #dialog-x, #dialog-y, #dialog-z").dialog(
{
autoOpen: false,
buttons: { 'OK': function() { $(this).dialog("close"); } },
modal: true,
width: 200
});
$("#button-a-dialog").click(function (event) {
$("#dialog-a").dialog('open');
event.preventDefault();
});
$("#button-b-dialog").click(function (event) {
$("#dialog-b").dialog('open');
event.preventDefault();
});
$("#button-c-dialog").click(function (event) {
$("#dialog-c").dialog('open');
event.preventDefault();
});
$("#button-d-dialog").click(function (event) {
$("#dialog-d").dialog('open');
event.preventDefault();
});
$("#button-e-dialog").click(function (event) {
$("#dialog-e").dialog('open');
event.preventDefault();
});
$("#button-f-dialog").click(function (event) {
$("#dialog-f").dialog('open');
event.preventDefault();
});
$("#button-g-dialog").click(function (event) {
$("#dialog-g").dialog('open');
event.preventDefault();
});
$("#button-h-dialog").click(function (event) {
$("#dialog-h").dialog('open');
event.preventDefault();
});
$("#button-i-dialog").click(function (event) {
$("#dialog-i").dialog('open');
event.preventDefault();
});
$("#button-j-dialog").click(function (event) {
$("#dialog-j").dialog('open');
event.preventDefault();
});
$("#button-k-dialog").click(function (event) {
$("#dialog-k").dialog('open');
event.preventDefault();
});
$("#button-l-dialog").click(function (event) {
$("#dialog-l").dialog('open');
event.preventDefault();
});
$("#button-m-dialog").click(function (event) {
$("#dialog-m").dialog('open');
event.preventDefault();
});
$("#button-n-dialog").click(function (event) {
$("#dialog-n").dialog('open');
event.preventDefault();
});
$("#button-o-dialog").click(function (event) {
$("#dialog-o").dialog('open');
event.preventDefault();
});
$("#button-p-dialog").click(function (event) {
$("#dialog-p").dialog('open');
event.preventDefault();
});
$("#button-q-dialog").click(function (event) {
$("#dialog-q").dialog('open');
event.preventDefault();
});
$("#button-r-dialog").click(function (event) {
$("#dialog-r").dialog('open');
event.preventDefault();
});
$("#button-s-dialog").click(function (event) {
$("#dialog-s").dialog('open');
event.preventDefault();
});
$("#button-t-dialog").click(function (event) {
$("#dialog-t").dialog('open');
event.preventDefault();
});
$("#button-u-dialog").click(function (event) {
$("#dialog-u").dialog('open');
event.preventDefault();
});
$("#button-v-dialog").click(function (event) {
$("#dialog-v").dialog('open');