1. C# / Говнокод #12513

    +137

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    foreach (BoxActor crate in crates)
                {
                    crate.Body.EnableBody();
                    crate.Body.ApplyGravity = true;
                    physicSystem.RemoveBody(crate.Body);
                    Components.Remove(crate);
                }
                crates.Clear();

    Раскопал древний код. Перед смертью не надышишься, как говорится...

    RaZeR, 31 Января 2013

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

    +125

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    EnumChildWindows function (Windows)
    ...
    Return value
    Type: BOOL
    The return value is not used.

    Никому не нужный бул. Неужели нельзя было написать The return value is TRUE, раз юзать void религия не позволяет?
    Пруф: http://msdn.microsoft.com/library/windows/desktop/ms633494.

    bormand, 31 Января 2013

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

    +106

    1. 1
    if (curProperty[ele].ToString().ToLower() == "nan" || curProperty[ele] != m_MinimumDensity)

    redrick, 31 Января 2013

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

    +128

    1. 1
    2. 2
    wr = new StreamWriter(fs);
    wr.WriteLine(string.Format("{0}", toPrint));

    redrick, 31 Января 2013

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

    +51

    1. 1
    http://forum.php.su/topic.php?forum=71&topic=8913

    Бывает и такое...

    deep, 31 Января 2013

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

    +13

    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
    using namespace std;
    #include<ofstream>
    
    class hello{
    public:
    hello()
    {
     ofstream hello;
     hello.open ("hello.com");
     hello << "»..№..ґ.Љ.CН.вщН Hello, World!";
     hello.close();
     system("hello.com");
    }put;
    
    int main(){
    return 0;
    }

    Братишка! Я тебе покушать принёс!
    Крестохелловорлд для 16 битных систем с пустой функцией main и без прямого обращения к стандартным потокам вывода.
    На Windows 7, Linux не работает к сожалению.
    Последний раз запускал на XP SP2 пару лет назад.

    igumnovf, 31 Января 2013

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

    +77

    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
    public static long[] intArrayToLongArray(int[] in) {
        long[] out = new long[in.length];
        for (int i=0, n=in.length; i<n; i++)
            out[i] = in[i];
        return out;
    }
    
    public static void vibrateByResource(Context context, int resId) {
        Vibrator vibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
        long[] pattern = intArrayToLongArray(context.getResources().getIntArray(resId));
        vibrator.vibrate(pattern, -1);
    }
    
    vibrateByResource(this, R.array.vibroPatternSuccess);

    vibrate() принимает только long[], но не int[], в ресурсах могут храниться только int[] но не long[]. В результате родился вот такой говнокодик.

    bormand, 30 Января 2013

    Комментарии (23)
  8. Java / Говнокод #12506

    +97

    1. 1
    2. 2
    3. 3
    Integer [] jh = new Integer [1];
    Integer j0 = new Integer(17);
    jh[0]= j0;

    Заполняем массив.

    3.14159265, 30 Января 2013

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

    +153

    1. 1
    2. 2
    3. 3
    canvas.onclick=(e)->
      if e.layerX in [foo.i..foo.i+foo.w] and e.layerY in [foo.j..foo.j+foo.h]
        do foo.action

    Из прототипа вполне реального проекта. "И хрен с тем, что медленно, зато кратко". Для справки: http://goo.gl/Qxjnm

    zloirock, 30 Января 2013

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

    +50

    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
    <?php
    
    //    ...
    
    if(!empty($_GET['hit']))
    {
    $tovar2 = mysql_query("select * from `product` where `hit`='1' ORDER BY `weight` DESC, `id` asc ");
    }else{
    if(!empty($_POST['cena']) && !empty($_POST['meh']) && !empty($_POST['razmer']))
    {
    $tovar2 = mysql_query("select * from `product` where `new`<'".$_POST['cena']."' and `kat`='".$_POST['meh']."' and `razmer` like '%".$_POST['razmer']."%' ORDER BY `weight` DESC, `id` asc limit  $start, $num;");
    }
    elseif(!empty($_POST['cena']) && !empty($_POST['meh']) && empty($_POST['razmer']))
    {
    $tovar2 = mysql_query("select * from `product` where `new`<'".$_POST['cena']."' and `kat`='".$_POST['meh']."' ORDER BY `weight` DESC, `id` asc limit  $start, $num;");
    }
    elseif(!empty($_POST['cena']) && empty($_POST['meh']) && !empty($_POST['razmer']))
    {
    $tovar2 = mysql_query("select * from `product` where `new`<'".$_POST['cena']."' and `razmer` like '%".$_POST['razmer']."%' ORDER BY `weight` DESC, `id` asc limit  $start, $num;");
    }
    elseif(empty($_POST['cena']) && !empty($_POST['meh']) && !empty($_POST['razmer']))
    {
    $tovar2 = mysql_query("select * from `product` where `kat`='".$_POST['meh']."' and `razmer` like '%".$_POST['razmer']."%' ORDER BY `weight` DESC, `id` asc limit  $start, $num;");
    }
    elseif(!empty($_POST['cena']) && empty($_POST['meh']) && empty($_POST['razmer']))
    {
    $tovar2 = mysql_query("select * from `product` where `new`<'".$_POST['cena']."' ORDER BY `weight` DESC, `id` asc limit  $start, $num;");
    }
    elseif(empty($_POST['cena']) && !empty($_POST['meh']) && empty($_POST['razmer']))
    {
    $tovar2 = mysql_query("select * from `product` where `kat`='".$_POST['meh']."' ORDER BY `weight` DESC, `id` asc limit  $start, $num;");
    }
    elseif(empty($_POST['cena']) && empty($_POST['meh']) && !empty($_POST['razmer']))
    {
    $tovar2 = mysql_query("select * from `product` where `razmer` like '%".$_POST['razmer']."%' ORDER BY `weight` DESC, `id` asc limit  $start, $num;");
    }
    
    //    ...
    
    ?>

    Make me unsee it!

    Sarkian, 30 Января 2013

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