1. Objective C / Говнокод #10200

    −153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    - (void)dealloc {
        LandscapeNote *tempCell;
        for (NSInteger i = 0; i < [_scrollView.subviews count]; i++) {
            tempCell = [_scrollView.subviews objectAtIndex:i];
            [tempCell removeFromSuperview];
        }
        [notesArray release];
        [self viewDidUnload];
        [super dealloc];
    }

    смотрим название метода...

    kilovata, 05 Мая 2012

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

    +83

    1. 1
    $v = (((bool) $v) ? true : false);

    somnambulism, 05 Мая 2012

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

    +71

    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
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    <?php
    session_start();
    $uploadName = 'test'; 
    if (isset($_GET['ajax'])) { 
        if (isset($_SESSION["upload_progress_$uploadName"])) { 
            $progress = $_SESSION["upload_progress_$uploadName"];
            $percent = round(100 * $progress['bytes_processed'] / $progress['content_length']);
    $text1 = iconv("CP1251", "UTF-8", "Общий прогресс загрузки: ");
    $text2 = iconv("CP1251", "UTF-8", "Загружается файл: ");
    $text3 = iconv("CP1251", "UTF-8", "Общее время загрузки: ");
    $text4 = iconv("CP1251", "UTF-8", "Скорость загрузки: ");
    $text5 = iconv("CP1251", "UTF-8", " сек. ");
    $text6 = iconv("CP1251", "UTF-8", " Мбайт. ");
    echo '<HTML><HEAD><title>Upload</title><meta name="keywords"><meta name="description" ><meta http-equiv="content-type" content="text/html;charset=windows-1251"></HEAD><BODY>';
    $pos1 = $percent * 4;
    $pos2 = 400 - $pos1;       
      echo '<div style="background: #00ff00; width: '.$pos1.'; height: 10px; border: solid 1px black; "></div><div style="background: #ffe4e1; width: '.$pos2.'px; height: 10px; position: relative; left: '.$pos1.'px; top: -12px; border: solid 1px black;"></div>';     
      echo '<div align="center" style="width: 400;">';       
            echo '<b>'.$text1.$percent.'%<br>';        
            $t3 = time() - $progress[start_time];
            echo $text3.$t3.$text5.'<br>'; 
            if ($t3 < 1 ) { $t3 = 1; } 
    $speed = (($progress[bytes_processed] / $t3) / 1024) / 1024;
            echo $text4.$formatted = sprintf ("%01.2f", $speed).$text6.'</b><br>'; 
    for($i=0;$i<count($progress[files]);$i++){ echo $text2.$progress[files][$i][name].'<br>'; } 
    echo '</div>';
        } else {
            echo '<div align="center" style="width: 400;">no uploading</div>';
        }
        exit;
    } elseif (isset($_GET['frame'])) { ?>
        <div align="center"><form align="center" action="" method="POST" enctype="multipart/form-data">
            <input type="hidden" name="<?=ini_get("session.upload_progress.name")?>"
                    value="<?=$uploadName?>" />
            <input type="file" name="file[]" multiple="true"/><input value="Загрузить" type="submit" /></form></div>
    <?php
    if($_FILES){
    for($i=0;$i<count($_FILES["file"]["name"]);$i++){
    if(is_uploaded_file($_FILES["file"]["tmp_name"][$i])){    
    move_uploaded_file($_FILES["file"]["tmp_name"][$i], "upload/".$_FILES["file"]["name"][$i]);   
    }
    }
    echo '<div align="center">загружено</div>';
    }
    ?>    
    <?php } else { ?>
    <HTML><HEAD><title>Upload</title><meta name="keywords"><meta name="description" ><meta http-equiv="content-type" content="text/html;charset=windows-1251">
    </HEAD><BODY><div align="center" style="width: 400;"><H3>Загрузчик файлоф на сайт</H3>требования: PHP 5.4, Firefox 3,6  и выше</div>
        <iframe src="?frame" height="70" width="400" align="center" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="overflow:visible"></iframe>
        <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
        <script>
            $(function() {
                setInterval(function() { 
                    $.get('?ajax', function(data) { 
                        $('#ajax').html(data); 
                    });
                }, 500);
            });
        </script>
        <div id="ajax"></div>
    <?php }

    ...

    ra0ceq, 05 Мая 2012

    Комментарии (4)
  4. JavaScript / Говнокод #10196

    +157

    1. 1
    var c = 'function' === typeof o.pop ? [] : {};

    хуита, 05 Мая 2012

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

    +111

    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
    {$APPTYPE CONSOLE}
    {$R *.res}
    
    type
      TFTest = class
      public
        B: string;
        function Add(S: string = ''): TFTest;
        constructor Create(T: TFTest); overload;
      end;
    
    function TFTest.Add(S: string): TFTest;
    begin
      B := B + S;
      Exit(Self);
    end;
    
    var
      A: TFTest;
    
    constructor TFTest.Create(T: TFTest);
    begin
      B := T.B;
    end;
    
    begin
      writeln(TFTest.Create.Add('0')
        .Create((TFTest.Create(TFTest.Create(((((((TFTest.Create(TFTest.Create).Add('0')).Add('1').Create.Add('2')
        .Add as TObject).Create) as TFTest.ClassParent) as TFTest).Create).Add('3')).Add.Add('4').Create).Add('5')).Add('6')
        ).Add('7').B);
      readln;
    
    end.

    Кто правильно обьяснит этот код, получит... ничего получит :)

    ReckO, 05 Мая 2012

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

    +142

    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
    class Program
    {
        static void Main()
        {
            A a = new A();
            E e = new E();
            e = (E)(D)(C)(B)(A)a; //обычная конвертация =)
         }
    }
    
    class A { }
    class B : A { }
    class C : B { }
    class D : C { }
    class E : D { }

    Обычная явная конвертация =)

    Propgrammer93, 04 Мая 2012

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

    +101

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    Thread thread = new Thread(delegate() { 
                    Thread subThread = new Thread(delegate() { 
                        Thread subsubThread = new Thread(delegate() { 
                            Console.WriteLine("Hello World! Best version of first console propgram :)"); 
                            Console.ReadLine(); 
                        }); 
                    }); 
                });

    Лучшая версия первой консольной программы)

    Propgrammer93, 04 Мая 2012

    Комментарии (8)
  8. C# / Говнокод #10192

    +115

    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
    foreach (var sheet in paper.Decomposed)
    {
                    if (ct > 0 && sheet.Equals(paper.Decomposed[ct]))
                    {
                        paper.PaperPrice += paperPrice;
                        paper.PrintingPrice += printingPrice;
                        paper.PlatesPrice += platesPrice;
                        ct++;
                        continue;
                    }
                    ct++;
    ...
    }

    UniXoiD, 04 Мая 2012

    Комментарии (7)
  9. JavaScript / Говнокод #10191

    +150

    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
    function (post, hash) {
        if (!vk.id || cur.viewAsBox) return;
    
        var icon = ge('like_icon' + post),
            my = hasClass(icon, hasClass(icon, 'fw_like_icon') ? 'fw_my_like' : 'my_like'),
            matches = post.match(/(-?\d+)(_?)(photo|video|note|topic|wall_reply|note_reply|photo_comment|video_comment|topic_post|)(\d+)/),
            like_obj = (matches[3] || 'wall') + matches[1] + '_' + matches[4],
            ref = cur.wallType ? (cur.wallType == 'feed' ? 'feed_' + cur.section : ('wall_' + (cur.onepost ? 'one' : (!(cur.wallType || '').indexOf('full_') ? 'full' : 'page')))) : cur.module;
    
        ajax.post('like.php', {act: 'a_do_' + (my ? 'un' : '') + 'like', 'object': like_obj, hash: hash, wall: 1, from: ref}, {
          onDone: wall.likeUpdate.pbind(post, !my)
        });
        var count = val(ge('like_real_count_wall' + post) || ge('like_count' + post));
        wall.likeUpdate(post, !my, intval(count) + (my ? -1 : 1));
        if (cur.onWallLike) {
          cur.onWallLike();
        }
      }

    Зачем посоны из контакта пишут такой говно-код? Куда смотрит Паша?

    mark, 04 Мая 2012

    Комментарии (4)
  10. Objective C / Говнокод #10190

    −148

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
     if([value objectForKey:fTimestamp] == [NSNull null]){
            objectData.Timestamp = [[value objectForKey:fTimestamp]intValue];
        }else{
            objectData.Timestamp = 0;
        }

    В зарелизинной версии проекта было.
    А я сидел и думал, почему половина полей из базы маппятся в нули в классы сущностей...

    dove06, 04 Мая 2012

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