1. Лучший говнокод

    В номинации:
    За время:
  2. Java / Говнокод #7254

    +129

    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
    46. 46
    47. 47
    48. 48
    public static String forHTML(String aText){
         final StringBuilder result = new StringBuilder();
         final StringCharacterIterator iterator = new StringCharacterIterator(aText);
         char character =  iterator.current();
         while (character != CharacterIterator.DONE ){
           if (character == '<') {
             result.append("&lt;");
           }
           else if (character == '>') {
             result.append("&gt;");
           }
           else if (character == '&') {
             result.append("&amp;");
          }
           else if (character == '\"') {
             result.append("&quot;");
           }
           else if (character == '\t') {
             addCharEntity(9, result);
           }
           else if (character == '!') {
             addCharEntity(33, result);
           }
           else if (character == '#') {
             addCharEntity(35, result);
           }
           else if (character == '$') {
             addCharEntity(36, result);
           }
    ........................................
           else if (character == '|') {
             addCharEntity(124, result);
           }
           else if (character == '}') {
             addCharEntity(125, result);
           }
           else if (character == '~') {
             addCharEntity(126, result);
           }
           else {
             //the char is not a special one
             //add it to the result as is
             result.append(character);
           }
           character = iterator.next();
         }
         return result.toString();
      }

    Escape special characters for wiseguys.
    http://www.javapractices.com/topic/TopicAction.do?Id=96

    3.14159265, 15 Июля 2011

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

    +161

    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
    /*
    * Получаем категории из массива ЭКСПЕРЕМЕНТАЛЬНАЯ ФУНКЦИЯ :D
    * $fp - файл
    * $content - то что запишем
    */
    function save_conf($fp, $content) 
    {
    	$file_name = basename($fp);
    	if(!file_exists($fp))
    	{
    		file_put_contents($fp,'');
    		@chmod(ROOT . $fp, 0666 );
    	}
    	if (file_exists($fp) && $content) 
    	{
    		$fp = fopen($fp, "wb");
    		$content = "<?php
    if (!defined('ACCESS')) 
    {
        header('Location: /');
        exit;
    }
    \n\n".$content."\n";
    		fwrite($fp, $content);
    		fclose($fp);
    	}
    }

    И как же он тут получит категории остаётся загадкой, и поржать он любит в комментариях смотрю)
    * BY Toogle CMS

    nethak, 12 Июля 2011

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

    +157

    1. 1
    2. 2
    3. 3
    $a = '123456789';
    $b = str_replace('8','9',preg_replace('6','7',str_replace('1','2',str_replace('2','3',str_replace('3','4',str_replace('5','6',$a))))));
    $b = substr($b,str_replace('123456789','one|two|three|four|five|six|seven|eight|nine'$a))

    Так и не понял, чего хотел добиться автор

    substr, 11 Июля 2011

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

    +158

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    if ($category) {
            $api_categories = $category['api_categories'];
            $params['categories'] = $category['api_categories'];
    } else {
        $api_categories = array();
        foreach ($categories as $category_data) {
            $api_categories = array_merge($api_categories, $category_data['api_categories']);
        }
    }
            
    $params['categories'] = $api_categories;

    Вот нафигачил то

    striker, 07 Июля 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    <?php
    $opis = trim(esc(implode(NULL,file($dir_loads.'/'.$file.'.txt'))));  // читаем файл
    echo $opis;
    ?>

    Без комментариев даже..

    icq677555, 06 Июля 2011

    Комментарии (8)
  7. ActionScript / Говнокод #7155

    −109

    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
    public function UiAnalyticVO()
    		{
    		}
    		
    		public function get ageGroup():String
    		{
    			var ageGroup:String;
    // Данные о возрасте пользователя никогда не отправляются, важно только
    // чтобы он был старше 18 (хз зачем).
    // Возраст пользователя устанавливается 1 раз за всю жизнь приложения,
    // даже если у него случится день Рождения - об этом приложение не
    // узнает.
    			if (_age)
    			{
    				ageGroup = _age < 18 ? "1":"2";
    			}
    			else
    			{
    				ageGroup = "0";//undefined age
    			}
    			return ageGroup;
    		}
    . . .
    // эту функцию вызывают много раз в секунду
    		protected function sendAnalytics(categoryType:String, evtType:String):void
    		{
    // жизненный цикл этого объекта - ровно пока не отработает эта функция, 
    // потом он жертва мусорщика
    			var analyticsVo:UiAnalyticVO = new UiAnalyticVO();
    . . .

    Тут прийдется немного нарпячь воображение, чтобы понять, что происходит. Kак бы много всего одновременно... (и даже больше, но для того, чтобы объяснить на сколько все плохо пришлось бы очень много постить. Я думаю, этого должно хватить :)

    wvxvw, 05 Июля 2011

    Комментарии (8)
  8. 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)
  9. C++ / Говнокод #7123

    +147

    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
    try
    {
        // A lot of code
    }
    catch (Exception &exception)
    {
        Application->ShowException(&exception);
    }
    catch (...)
    {
        try
        {
           throw Exception("");
        }
        catch (Exception &exception)
        {
            Application->ShowException(&exception);
        }
    }

    :) Обработка исключений

    egoroff, 01 Июля 2011

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

    +136

    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
    <style>
    .comments_indent_holder .comment { margin-left:400px;}
    .comments_indent_holder .indent_0 {	margin-left:38px;}
    .comments_indent_holder .indent_1 {	margin-left:58px;}
    .comments_indent_holder .indent_2 {	margin-left:78px;}
    .comments_indent_holder .indent_3 {	margin-left:98px;}
    .comments_indent_holder .indent_4 {	margin-left:118px;}
    .comments_indent_holder .indent_5 {	margin-left:138px;}
    .comments_indent_holder .indent_6 {	margin-left:158px;}
    .comments_indent_holder .indent_7 {	margin-left:178px;}
    .comments_indent_holder .indent_8 {	margin-left:198px;}
    .comments_indent_holder .indent_9 {	margin-left:218px;}
    .comments_indent_holder .indent_10 { margin-left:238px;}
    .comments_indent_holder .indent_11 { margin-left:258px;}
    .comments_indent_holder .indent_12 { margin-left:278px;}
    .comments_indent_holder .indent_13 { margin-left:298px;}
    .comments_indent_holder .indent_14 { margin-left:318px;}
    .comments_indent_holder .indent_15 { margin-left:338px;}
    .comments_indent_holder .indent_16 { margin-left:358px;}
    .comments_indent_holder .indent_17 { margin-left:378px;}
    .comments_indent_holder .indent_18 { margin-left:398px;}
    .comments_indent_holder .indent_19 { margin-left:418px;}
    .comments_indent_holder .indent_20 { margin-left:438px;}
    </style>
    
    
    <div id="6509734" class="comment indent_0 u28525">
    	....
    </div>
    		
    			
    <div id="6509750" class="comment indent_1 u34409">
    	....
    </div>

    одно иллитарное сообщество с ограниченной вложенностью камментов. facepalm.svg

    DrFreez, 29 Июня 2011

    Комментарии (8)
  11. JavaScript / Говнокод #7084

    +158

    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
    $('#home').click(function(){
            $.get("q.php", { id: 1 }, function(data){                            
                $('#content').html(data);
            });
        });
    
        $('#programz').click(function(){
            $.get("q.php", { id: 2 }, function(data){                            
                $('#content').html(data);
            });
        });
    				
        $('#contactz').click(function(){
            $.get("q.php", { id: 3 }, function(data){                            
                $('#content').html(data);
            });
        });
    	
        $('#aboutazz').click(function(){
            $.get("q.php", { id: 4 }, function(data){                            
                $('#content').html(data);
            });
        });
    	
        $('#chatz').click(function(){
            $.get("q.php", { id: 5 }, function(data){                            
                $('#content').html(data);
            });
        });  
    
        $('#advertisement').click(function(){
            $.get("q.php", { id: 6 }, function(data){               
                $('#content').html(data);
            });

    Jquery во всей красе.

    bteam, 27 Июня 2011

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