1. JavaScript / Говнокод #15623

    +157

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    if (settings.bgType === 'pattern')
    {
        if (settings.bgPattern.pack === 'bg-dark') return App.Area.color.light;
        else return App.Area.color.dark;
    }
    else
    {
        return App.Area.color.invert;
        console.log('invert');
    }

    смотрю, что в консоли пусто, и думаю, почему не работает?

    Itareo, 31 Марта 2014

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

    −131

    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
    protected function ignite(event:FlexEvent):void {
        imgCooser.dataProvider = new ArrayList([new ObjectProxy({w:Math.round(Math.random()*100+55),t:'0 one'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'1 two'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'2 three'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'3 four'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'4 five'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'5 six'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'6 seven'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'7 eight'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'8 nine'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'9 ten'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'10 eleven'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'11 twelve'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'12 one'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'13 two'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'14 three'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'2 three'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'3 four'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'4 five'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'5 six'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'6 seven'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'7 eight'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'8 nine'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'9 ten'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'10 eleven'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'11 twelve'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'12 one'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'13 two'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'14 three'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'1 two'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'2 three'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'3 four'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'4 five'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'5 six'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'6 seven'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'7 eight'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'8 nine'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'9 ten'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'10 eleven'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'11 twelve'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'12 one'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'13 two'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'14 three'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'2 three'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'3 four'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'4 five'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'5 six'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'6 seven'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'7 eight'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'8 nine'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'9 ten'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'10 eleven'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'11 twelve'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'12 one'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'13 two'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'14 three'}),
                   new ObjectProxy({w:Math.round(Math.random()*100+55),t:'15 four'})]);

    От нечего делать сижу и перебираю коммиты в репозитории, вот наткнулся...

    wvxvw, 30 Марта 2014

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

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $uu=substr($d_users,-2);
    $ux1=array(2,3,4,22,23,24,32,33,34,42,43,44,52,53,54,62,63,64,72,73,74,82,83,84,92,93,94);
    $ux2=array(1,21,31,41,51,61,71,81,91);
    $ut='Участников';
    if(in_array($uu,$ux1)){ $ut='Участника'; }
    elseif(in_array($uu,$ux2)){ $ut='Участник'; }

    norvele, 30 Марта 2014

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

    −136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public function TweenMax(target:Object, duration:Number, vars:Object) {
    	super(target, duration, vars);
    	if (TweenLite.version < 11.2) {
    		throw new Error("TweenMax error! Please update your TweenLite class or try deleting your ASO files. TweenMax requires a more recent version. Download updates at http://www.TweenMax.com.");
    	}

    Тут нужно дополнительно подчеркнуть, что оба класса TweenMax и TweenLite распространяются вместе, и случайно получить несоответствующую версию очень тяжело (ее надо самому поменять).
    Но самое интересное в другом: ASO файлы - это артефакт механизма кеширования использовавшегося в AS2. В AS3 механизм кеширования другой, и об этих файлах давным-давно никто не слышал. Тем не менее, сообщение об ошибке по прежнему предлагает пользователям с ними побороться.

    wvxvw, 30 Марта 2014

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

    +141

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if($ID==265265265)
    $peremen1 = "poo poo!"
    $whatdo = "Eat"
    $peremen2 = "da"
    echo "$whatdo "."$peremen2 " .$peremen1" //Вот это доставляет
    $var = $ID
    $ci = $var + $ID //Хмм... Объясните, ЗАЧЕМ?

    vk.com/im/
    2011г.
    Видимо они планировали регистрацию юзера с айди 265265265

    Getup1NEW, 30 Марта 2014

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

    +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
    do
    echo $fun
    $fun = $sand + $sand
    $sand = $sand +1
    echo $sand."is not".$var
    $var = $sand + $fun
    $deer = 23
    while($deer==23)
    if($var==445)
    {
     $fun==2
    }

    Из моих наработок для BrowserFucker

    Getup1NEW, 30 Марта 2014

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    // yes, this code is a bit crazy, but it works and we have tests to prove it!
    // this piece should be kept in sync with the traversal in $broadcast
    if (!(next = (current.$$childHead ||
        (current !== target && current.$$nextSibling)))) {
      while(current !== target && !(next = current.$$nextSibling)) {
        current = current.$parent;
      }
    }

    Из исходников AngularJS

    Itareo, 30 Марта 2014

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

    +61

    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
    #include <iostream>
    #include <iomanip>
    
    using std::boolalpha;
    using std::cout;
    using std::endl;
    
    template <class N>
    bool getbit(N var, int bit)
    {
        size_t bsz = sizeof(N)*8;
        return ((bsz>=bit)?((var>>bit)%2):(0));
    }
    
    template <class N>
    bool bitCompare(N a, N b)
    {
        size_t bsz = sizeof(N)*8;
    
    	for (size_t i = 0; i < bsz; i++)
    	{
            bool gba = getbit(a, i);
    		bool gbb = getbit(b, i);
    		if (gba != gbb)
    		{
    			return false;
    		}
    	}
    
    	return true;
    }
    
    int main(int argc, char* argv[])
    {
    	cout << "100500 == 100500:" << boolalpha << bitCompare(100500, 100500) << endl;
    	cout << "100500 == 9000: " << bitCompare(100500, 9000) << endl;
    	cout << "'H' == 'H': " << bitCompare('H', 'H') << endl;
    	cout << "'H' == 'K': " << bitCompare('H', 'K') << endl;
    
    	return 0;
    }

    Байтоебство проходили... Дамы и господа! Встречайте битоебство!

    gost, 29 Марта 2014

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

    +156

    1. 1
    2. 2
    if (l > 0) l += (1 - l) * l;
    else if (l < 0) l *= 1 - (- l);

    Itareo, 29 Марта 2014

    Комментарии (28)
  10. Java / Говнокод #15612

    +65

    1. 1
    grade : 100 >= "A" >= 90 > "B" >= 80 > "C" >= 70 > "D" >= 60 > "E" >= 0;

    Кто-нибудь догадается, что сие может значить? :)

    parzh, 28 Марта 2014

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