1. PHP / Говнокод #20116

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <ul>
        {foreach $сity as $c}
            {if Core::model()->getValue($c,'name') === $form->city_name}
                {assign $form->city_id $c['id']}
            {/if}
            <li data-value="{$c['id']}" class="{if $c['id']===$form->city_id}active{/if}"><span>{Core::model()->getValue($c,'name')}</span></li>
        {/foreach}
    </ul>

    Типичный шаблон на фреймворках PHP, в данном случае Yii 1.1

    M-A-X, 01 Июня 2016

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

    −3

    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
    [Wed Jun 01 10:13:25.866953 2016] [autoindex:error] [pid 30710] [client 77.222.112.203:24108] AH01276: Cannot serve directory /home/u325415/test.alpina-nerud.ru/www/: No matching DirectoryIndex (index.html,index.htm,index.php,index.php3,index.phtml,index.cgi,index.pl,index.shtml,default.htm,default.html) found, and server-generated directory index forbidden by Options directive
    [Wed Jun 01 10:21:28.044222 2016] [autoindex:error] [pid 4437] [client 77.222.112.203:30432] AH01276: Cannot serve directory /home/u325415/test.alpina-nerud.ru/www/: No matching DirectoryIndex (index.html,index.htm,index.php,index.php3,index.phtml,index.cgi,index.pl,index.shtml,default.htm,default.html) found, and server-generated directory index forbidden by Options directive
    [Wed Jun 01 10:28:39.825066 2016] [autoindex:error] [pid 10534] [client 77.222.112.203:36957] AH01276: Cannot serve directory /home/u325415/test.alpina-nerud.ru/www/: No matching DirectoryIndex (index.html,index.htm,index.php,index.php3,index.phtml,index.cgi,index.pl,index.shtml,default.htm,default.html) found, and server-generated directory index forbidden by Options directive
    [Wed Jun 01 12:11:48.394301 2016] [:error] [pid 6058] [client 77.222.112.203:37192] PHP Warning:  require(typo3/sysext/core/Classes/Core/Bootstrap.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/u325415/test.alpina-nerud.ru/www/index.php on line 48
    [Wed Jun 01 12:11:48.394400 2016] [:error] [pid 6058] [client 77.222.112.203:37192] PHP Warning:  require(typo3/sysext/core/Classes/Core/Bootstrap.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/u325415/test.alpina-nerud.ru/www/index.php on line 48
    [Wed Jun 01 12:11:48.394426 2016] [:error] [pid 6058] [client 77.222.112.203:37192] PHP Fatal error:  require() [<a href='function.require'>function.require</a>]: Failed opening required 'typo3/sysext/core/Classes/Core/Bootstrap.php' (include_path='.:/usr/share/php53:/usr/share/pear53') in /home/u325415/test.alpina-nerud.ru/www/index.php on line 48
    [Wed Jun 01 12:18:39.840563 2016] [:error] [pid 12269] [client 77.222.112.203:15356] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1, referer: http://test.alpina-nerud.ru/typo3/
    [Wed Jun 01 12:18:42.839703 2016] [:error] [pid 12319] [client 77.222.112.203:15413] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:18:45.376653 2016] [:error] [pid 12333] [client 77.222.112.203:15456] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:19:02.624195 2016] [:error] [pid 12557] [client 77.222.112.203:15794] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:19:04.446064 2016] [:error] [pid 12573] [client 77.222.112.203:15826] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:20:25.263810 2016] [:error] [pid 13455] [client 77.222.112.203:17281] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:21:43.511456 2016] [:error] [pid 14762] [client 77.222.112.203:18648] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:21:54.006698 2016] [:error] [pid 14760] [client 77.222.112.203:18644] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:21:56.294966 2016] [:error] [pid 14894] [client 77.222.112.203:18855] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:22:11.178438 2016] [:error] [pid 15124] [client 77.222.112.203:19238] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:23:17.882880 2016] [:error] [pid 15798] [client 77.222.112.203:20386] PHP Warning:  require(sysext/core/Classes/Core/Bootstrap.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/u325415/test.alpina-nerud.ru/www/typo3/init.php on line 55
    [Wed Jun 01 12:23:17.882976 2016] [:error] [pid 15798] [client 77.222.112.203:20386] PHP Warning:  require(sysext/core/Classes/Core/Bootstrap.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/u325415/test.alpina-nerud.ru/www/typo3/init.php on line 55
    [Wed Jun 01 12:23:17.883003 2016] [:error] [pid 15798] [client 77.222.112.203:20386] PHP Fatal error:  require() [<a href='function.require'>function.require</a>]: Failed opening required 'sysext/core/Classes/Core/Bootstrap.php' (include_path='.:/usr/share/php53:/usr/share/pear53') in /home/u325415/test.alpina-nerud.ru/www/typo3/init.php on line 55

    Ошибка в логах

    ponoroshca, 01 Июня 2016

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

    −3

    1. 1
    { "destination_addresses" : [ "Seattle, Washington, USA" ], "origin_addresses" : [ "Vancouver, Britisch-Kolumbien, Kanada" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "229 km", "value" : 229112 }, "duration" : { "text" : "2 Stunden, 35 Minuten", "value" : 9311 }, "status" : "OK" } ] } ], "status" : "OK" }

    viromax, 01 Июня 2016

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <?
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC&destinations=Seattle&mode=driving&language=de");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    $response = curl_exec($ch);
    echo $response;
    $array = json_decode($response, true);
    echo $array["destination_addresses"];
    ?>

    viromax, 01 Июня 2016

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

    +5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    public void TrimExcess()
    {
    	int num;
    	num = (int) (((double) ((int) this._items.Length)) * 0.9);
    	if (this._size >= num)
    	{
    		goto Label_002A;
    	}
    	this.Capacity = this._size;
    Label_002A:
    	return;
    }

    Хуброхапр

    dm_fomenok, 01 Июня 2016

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

    +2

    1. 1
    2. 2
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="format-detection" content="telephone=no"/><title>MINI-MBA Professional</title></head><body style="-webkit-text-size-adjust: none; margin: 0; padding: 0; background-color: #f5f5f5"><img src="http://outlineagency.go2cloud.org/aff_i?offer_id=14&aff_id=1004&aff_sub=release_1&source=mailing" width="1" height="1" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#f5f5f5"><tr><td valign="top" style="border-collapse: collapse"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td style="border-collapse: collapse"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"><tr>

    всего-то две строчки поправить
    https://gyazo.com/1a9d5a74da2212b7f758adbf908d2c1c

    ngc-598, 01 Июня 2016

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

    +5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    /**
       * Detects if the current device is using a mac OS
       */
      function DetectMacOSX() {
        if (stripos($this->userAgent, $this->macOSX) !== FALSE) {
          return TRUE;
        }
        else {
          return FALSE;
        }
      }

    vigasin, 01 Июня 2016

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

    +4

    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
    #define key \
        keySequence.keys[i]
    
    #define read_helper(val_)                 \
      file.read(                              \
          reinterpret_cast<char*>(&key.val_), \
          sizeof(decltype(key.val_))          \
      )
    
    for (DWORD i = 0; i < keyPointer.Count; i++)
      read_helper(RotationQuaternion);
    
    for (DWORD i = 0; i < keyPointer.Count; i++)
      read_helper(TimeValue);
    
    for (DWORD i = 0; i < keyPointer.Count; i++)
      read_helper(PositionValue),
      key.SwapBytes();
    
    #undef read_helper
    #undef key

    LispGovno, 31 Мая 2016

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

    +2

    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
    while (s != null)
                {
                    s = fs.ReadLine();
    
                    //arr  line example <rect x="0" y="0" rgba(92,41,235,0.9921568627451 
    
                    String[] arr = s.Split('(');
                    arr = arr[1].Split(',');
    
                    int fourPart = (int)(float.Parse(arr[3].Replace('.',',')) * 0xFF);
                    var binaryFour =  Convert.ToString(fourPart, 2);
    
                    while(binaryFour.Length < 8)
                    {
                        binaryFour = "0" + binaryFour;
                    }
    
                    int threePart = int.Parse(arr[2]);
                    var binaryThree = Convert.ToString(threePart, 2);
    
                    while (binaryThree.Length < 8)
                    {
                        binaryThree = "0" + binaryThree;
                    }
    
                    int twoPart = int.Parse(arr[1]);
                    var binaryTwo = Convert.ToString(twoPart, 2);
    
                    while (binaryTwo.Length < 8)
                    {
                        binaryTwo = "0" + binaryTwo;
                    }
    
                    int firstPart = int.Parse(arr[0]);
                    var binaryfirst = Convert.ToString(firstPart, 2);
    
                    number = Convert.ToInt32((binaryfirst + binaryTwo + binaryThree + binaryFour),2);
    
                    Write("number", number.ToString());
                }

    Хз как такое вообще появляется в голове

    partizanes, 31 Мая 2016

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

    +6

    1. 1
    2. 2
    3. 3
    4. 4
    > var x = new String("eval(x.toString())");
    undefined
    > eval(x.toString());
    RangeError: Maximum call stack size exceeded

    Yo dawg, I heard you like evaluation. So I put evaluation in your evaluation so you could evaluate while you evaluate
    Жаль что nodejs не осиливает заоптимизировать это как бесконечный цикл

    j123123, 31 Мая 2016

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