1. Java / Говнокод #7137

    +79

    1. 1
    2. 2
    boolean direct = !Boolean.FALSE.equals(directParam);
        boolean demoAgency = !direct;

    yvu, 03 Июля 2011

    Комментарии (45)
  2. PHP / Говнокод #7136

    +150

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function rustrtolower($s)
    	{
    		$from = array("А","Б","В","Г","Д","Е","Ё","Ж","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ч","Ш","Щ","Ъ","Ы","Ь","Э","Ю","Я","A","B","C","D","E","F","G","H","I","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","J");
    		$to =   array("а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","ъ","ы","ь","э","ю","я","a","b","c","d","e","f","g","h","i","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","j");
    		return str_replace($from, $to, $s);
    	}

    Мартин, 02 Июля 2011

    Комментарии (6)
  3. JavaScript / Говнокод #7135

    +151

    1. 1
    var GetUrl = /\[(.*)\]/g.exec("$SECTION_NAME$")[1].replace(/\-/i, '~').replace(/\-/i, '~');

    фу ;(

    substr, 02 Июля 2011

    Комментарии (2)
  4. PHP / Говнокод #7134

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if($inc == true){
         $counter_val = $cat[$this->FileCounterKey] + 1;
    }else{
         $counter_val = $cat[$this->FileCounterKey] - 1;
    }

    Класс деревьев в одной русской CMS. Метод пересчитывает кол-во файлов в категории после добавления/удаления.

    Мартин, 02 Июля 2011

    Комментарии (2)
  5. Java / Говнокод #7133

    +75

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    <% ServicePackage servicePackage = null; %>
    	<% char fi [] = {'g', 'v', 'p'}; %>
    	<% int  ni [] = {3, 7, 11}; %>
    	
    	<% for(int i = 0; i < fi.length; i++)
    		 for(int j = 1; j <= ni[i]; j++)
    		 	{
    		 		String id = "", name = null, brief = null, price = null;
    		 		id += (char)fi[i];
    		 		if (j >= 10) 
    		 			id += (char)('0' + j / 10);
    		 		id += (char)('0' + j % 10);
    		 		
    		 		servicePackage = AllServicePackages.map.get(id);
    		 		if (servicePackage != null)
    		 		{
    		 			name = servicePackage.getName();
    		 			brief = servicePackage.getBrief();
    		 			price = servicePackage.getPrise();
    		 		}
    		 		%>
    		 <%	} %>

    Автору хотелось перебрать все эл-ты map'а.

    qweqweqwe, 02 Июля 2011

    Комментарии (2)
  6. Objective C / Говнокод #7132

    −120

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    if( (ori == UIInterfaceOrientationLandscapeLeft) || (ori == UIInterfaceOrientationLandscapeRight))
    {
        // Some code
    }
    else if(ori==UIInterfaceOrientationPortrait || ori==UIInterfaceOrientationPortraitUpsideDown)
    {
        // Some other code
    }
    else {
        // God mode on!
    }

    Реальный проект после индусов... Что движет этими людьми я не понимаю...

    makadaw, 02 Июля 2011

    Комментарии (21)
  7. C++ / Говнокод #7131

    +166

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    // say this is some existing structure. And we want to use
    // a list. We can tell it that the next pointer
    // is apple::next.
    struct apple {
        int data;
        apple * next;
    };
    
    // simple example of a minimal intrusive list. Could specify the
    // member pointer as template argument too, if we wanted:
    // template<typename E, E *E::*next_ptr>
    template<typename E>
    struct List {
        List(E *E::*next_ptr):head(0), next_ptr(next_ptr) { }
    
        void add(E &e) {
            // access its next pointer by the member pointer
            e.*next_ptr = head;
            head = &e;
        }
    
        E * head;
        E *E::*next_ptr;
    };
    
    int main() {
        List<apple> lst(&apple::next);
    
        apple a;
        lst.add(a);
    }

    c++ страшный язык :) (часть вторая)

    C++: Pointer to class data member: http://stackoverflow.com/questions/670734/c-pointer-to-class-data-member

    Такие конструкции "E *E::*next_ptr;" без подготовки не осилить.

    Aleskey, 02 Июля 2011

    Комментарии (35)
  8. PHP / Говнокод #7130

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    // Обработка запроса
    for ($i = 1; $i<=300000; $i++)
    {
    $marat=$marat+10;
    }

    Эмуляция паузы при генерировании РНР-скриптом ответа для Flash-ки (сайт - онлайн казино)

    dekameron, 01 Июля 2011

    Комментарии (11)
  9. Perl / Говнокод #7129

    −116

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    sub _check_sms_hash {
        my $self = shift;
        my $q = shift;
    
        my $qs = $q->param('id').$q->param('phone').$q->param('trigger').$q->param('text').$q->param('date').$q->param('check').$self->_sicretsms();
        my $hash = $self->{DB}->selectrow_array("SELECT MD5(?)", undef, $qs);
        return 1 if $hash eq $q->param('sign');
        return 0;
    }

    Православное вычисление контрольной суммы.

    Alikus, 01 Июля 2011

    Комментарии (8)
  10. PHP / Говнокод #7128

    +151

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    $currN = 0;
            $countN = count($news);        
            $currW = 0;
            $countW = count($wall);
            $time = time();
            $date = date('Y-m-d H:i:s');
    
            // Жестянка в сферическом ваккуме куба
    		foreach($lenta as $k => &$v)
    		{
    		    while (($v['DZ'] <= $news[$currN]['DZ']))
    		    {
    		        while (($news[$currN]['DZ'] <= $wall[$currW]['DZ']) && ($currW < $countW))
    		        {
    		            $this->create_time($wall[$currW]['DZ'], $time, $date);
    		            $this->display_wall($wall[$currW]);
    		            ++$currW;		            
    		        }
    		        $this->create_time($news[$currN]['DZ'], $time, $date);
    		        $this->display_news($news[$currN]);
    		        ++$currN;
    		    }
    		    $this->create_time($v['DZ'], $time, $date);
    			$this->display_lenta($v, $usr);
    		}
    		
    		while ($currN < $countN)
    		{
    		    while (($news[$currN]['DZ'] <= $wall[$currW]['DZ']) && ($currW < $countW))
    		    {
    		        $this->create_time($wall[$currW]['DZ'], $time, $date);
    		        $this->display_wall($wall[$currW]);
    		        ++$currW;
    		    }		
    		    $this->create_time($news[$currN]['DZ'], $time, $date);
    		    $this->display_news($news[$currN]);
    		    ++$currN;		
    		}
    		
    		while ($currW < $countW)
    		{
    		    $this->create_time($wall[$currW]['DZ'], $time, $date);
    		    $this->display_wall($wall[$currW]);
    		    ++$currW;
    		}

    Просто и со вкусом.

    advvzlol, 01 Июля 2011

    Комментарии (2)