1. C++ / Говнокод #10218

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Controller::Controller(QObject *parent)
      : QObject(parent) {
      connect( &rcvr, SIGNAL(deviceMessage(QString,QString,QString,QString,QString,QString,QString,QString)),
               this,   SLOT(processMessage(QString,QString,QString,QString,QString,QString,QString,QString)) );
    }

    По порядку: таймштамп, домен, хост, логон, вендор флешки, модель, ревизия, серийник. Задвинул на полном серьёзе ))

    niko, 08 Мая 2012

    Комментарии (13)
  2. ActionScript / Говнокод #10215

    −159

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    appendExclamation("one")("two")("three")("four")("five");
    function appendExclamation(str:String):Function{
      trace(str + "! ");
      return appendExclamation;
    }
    /* outputs:
    one!
    two!
    three!
    four!
    five!
    */

    как-то натолкнулся на одном из блогов

    lammar, 08 Мая 2012

    Комментарии (9)
  3. ActionScript / Говнокод #10214

    −155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public function initCounter():void
    {
    	_timeDisplayer.text = (_type == COUNT) ? "00:00" : ((_timeLimit < 10) ? "0" + _timeLimit.toString() + ":00" : _timeLimit.toString() + ":00");
    	_seconds = (_type == COUNT) ? 0 : 60;
    	_minutes = (_type == COUNT) ? 0 : _timeLimit;
    	_counterCompleted = false;
    }

    еще одно тернарное извращение:)

    lammar, 08 Мая 2012

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

    +75

    1. 1
    2. 2
    3. 3
    4. 4
    require( "./configuration.php" );
    include( "./include.php" );
    $returned = @( );
    if ( ( $returned ) != @( "harper" ) )

    cthulhu25, 07 Мая 2012

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

    +86

    1. 1
    2. 2
    3. 3
    int createStageCycles = 0;
    createStageCycles = Integer.parseInt(strCycle);
    int nextVal = new Integer(createStageCycles) + 1;

    int двойного отжима

    zloizerg, 07 Мая 2012

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

    +80

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $F = 0;
    if ($F == "0") {
    include ("index-bd.php");
    }
    else {
    include ("../index-bd.php");
    };

    И так подключатся все файлы в проекте.

    Evil_Wolf, 07 Мая 2012

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

    −428

    1. 1
    2. 2
    3. 3
    4. 4
    url = request.get_full_path()
    if 'show_error' in url:
        show_param = url.split('?show_error=')
        error = show_param[1]

    Кусок кода из Django проекта
    Взяли индуса на работу. Вот так он достает GET параметры

    larikov, 07 Мая 2012

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

    +123

    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
    <table border="0" id="table" width="800" align="center">
    <tr><td colspan="5" align="center">Ваш заказ:</td></tr>
    
    <? $query=mysql_query("Select * from `$name`");
    for ($c=0; $c<mysql_num_rows($query);$c++){
    ?><?
    $result=mysql_fetch_array($query);
    $a=$result['menu_id'];
    $query1=mysql_query("SELECT * FROM menu WHERE id=$a");
    $result1=mysql_fetch_array($query1);
    ?>
    
    <tr><td width="50"><? echo $c+'1'; ?></td><td width="50" align="center"><img src="img/tira.png" style="height:20px; width:20px;"/></td><td><? echo $result1['name'];?></td><td><a href="#">-</a><input type="text" min="1" value="<? echo $result['count'];?>" max="40" size="2" /><a href="#" onclick="up()">+</a></td><td>удалить</td></tr>
    <script language="javascript" type="application/javascript">
    var a=parseInt("<? echo $result['count'];?>");
    function up(){
    var b = a + 1;
    document.write(b);
    }
    </script>
    <?
    }
    ?>

    "Создаю корзину покупателя! Формирую таблицу выбранных пользователем товаров и его кол-во в цикле! добавил функцию на OnClick с выводом значение в ячейке! при нажатии выводит только значение последнего товара из цикла." Слов нет.

    zloirock, 06 Мая 2012

    Комментарии (5)
  9. C# / Говнокод #10206

    +113

    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
    int width_of_rectangle = 690;// ширина 
    int height_of_rectangle = 395;// высота 
    int boundary_of_rectangle_x = 15;// граница по Х 
    int boundary_of_rectangle_у = 15;// граница по У 
    int size_of_ball = 25;// размер шарика 
    int size_of_move_of_ball = 3; // коефициент скорости от рамера шарика 
    private Bitmap myBitmap; 
    int position_of_ball_x,
        position_of_ball_y, 
        radius_of_ball_x, 
        radius_of_ball_y, 
        move_of_ball_x,
        move_of_ball_y,
        width_of_bitmap_of_ball,
        height_of_bitmap_of_ball,
        width_of_margin_of_bitmap,
        height_of_margin_of_bitmap;

    Структуры..? Не, не слышал!

    psina-from-ua, 05 Мая 2012

    Комментарии (12)
  10. Haskell / Говнокод #10205

    −84

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    data (,) a b = (,) a b
        deriving Generic
    data (,,) a b c = (,,) a b c
        deriving Generic
    data (,,,) a b c d = (,,,) a b c d
        deriving Generic
    .......
    data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__
     = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__
        -- deriving Generic
    {- Manuel says: Including one more declaration gives a segmentation fault.

    Вот такая вот реализация туплов:
    http://www.haskell.org/ghc/docs/7.4.1/html/libraries/ghc-prim-0.2.0.0/src/GHC-Tuple.html

    bormand, 05 Мая 2012

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