1. Лучший говнокод

    В номинации:
    За время:
  2. C# / Говнокод #20145

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    string tempFolder = DateTime.Now.Year.ToString("0000") 
    	+  DateTime.Now.Month.ToString("00")
    	+ DateTime.Now.Day.ToString("00")
    	+ "-" + DateTime.Now.Hour.ToString("00")
    	+ DateTime.Now.Minute.ToString("00")
    	+ DateTime.Now.Second.ToString("00");

    Kronic, 07 Июня 2016

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

    +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
    13. 13
    14. 14
    15. 15
    16. 16
    private string GetMinutes() 
    { 
          string minute = (DateTime.Now.Minute < 10) ? "0" + DateTime.Now.Minute.ToString() : DateTime.Now.Minute.ToString();  
    
          return minute; 
    }
    
    private string LogPath(string minute) 
    { 
         string logPath = Param.directory + @"\log(" + DateTime.Now.ToShortDateString() + " " 
                    + DateTime.Now.Hour.ToString() + "." + minute + ").txt"; 
         return logPath; 
    }
    
    string minute = GetMinutes(); //Минуты формата "мм" для имени файла ЛОГа. 
    return LogPath(minute);       //Путь файла ЛОГа

    dreamer, 06 Июня 2016

    Комментарии (3)
  4. 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)
  5. C++ / Говнокод #20073

    +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
    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
    //Collisions
    static float collisionradius;
    if(numplayers>1)
    	for(k=0;k<numplayers;k++){
    	for(i=k;i<numplayers;i++){
    	if(i==k)i++;
       			if(i<numplayers)
       					if((animation[player[i].targetanimation].attack!=reversed&&animation[player[i].targetanimation].attack!=reversal&&animation[player[k].targetanimation].attack!=reversed&&animation[player[k].targetanimation].attack!=reversal)||(i!=0&&k!=0))
       						if((animation[player[i].currentanimation].attack!=reversed&&animation[player[i].currentanimation].attack!=reversal&&animation[player[k].currentanimation].attack!=reversed&&animation[player[k].currentanimation].attack!=reversal)||(i!=0&&k!=0))
       							if(player[i].howactive<=typesleeping&&player[k].howactive<=typesleeping)
       								if(player[i].howactive!=typesittingwall&&player[k].howactive!=typesittingwall)
       									if(i!=k&&player[i].whichpatchx==player[k].whichpatchx&&player[i].whichpatchz==player[k].whichpatchz&&player[k].skeleton.oldfree==player[k].skeleton.free&&player[i].skeleton.oldfree==player[i].skeleton.free&&player[i].targetanimation!=climbanim&&player[i].targetanimation!=hanganim&&player[k].targetanimation!=climbanim&&player[k].targetanimation!=hanganim)
       										if(player[i].coords.y>player[k].coords.y-3)
       											if(player[i].coords.y<player[k].coords.y+3)
       												if(player[i].coords.x>player[k].coords.x-3)
       													if(player[i].coords.x<player[k].coords.x+3)
       														if(player[i].coords.z>player[k].coords.z-3)
       															if(player[i].coords.z<player[k].coords.z+3){
       																if(findDistancefast(&player[i].coords,&player[k].coords)<3*((player[i].scale+player[k].scale)*2.5)*((player[i].scale+player[k].scale)*2.5)){
      																	if(player[i].onfire||player[k].onfire){
      																		if(!player[i].onfire)player[i].CatchFire();
       																		if(!player[k].onfire)player[k].CatchFire();
       																	}
       																}
       																...

    http://hg.icculus.org/icculus/lugaru/file/97b303e79826/Source/GameTick.cpp#l7276

    gammaker, 25 Мая 2016

    Комментарии (3)
  6. JavaScript / Говнокод #20065

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    handleNewConfigRuleLoaded: function(
        this.handleConfigRuleLoaded0({rule: event.configRule}, true, false);
    },
    
    handleConfigRuleLoaded: function(event) {
        this.handleConfigRuleLoaded0(event.configRule, false, false);
    },

    Старый добрый бэкбон и не знания карринга

    NuclleaR, 24 Мая 2016

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

    0

    1. 1
    2. 2
    $.get( '/scripts/ajax/popup/add_to_favorite.php', { id: productID, ajax_call: 'Y' }, function ( data ) {
                        data = JSON.parse( data );

    $.getJSON
    http://www.sapato.ru/js/ajax/widgets/baseAjaxes.js?bust=208

    nik757, 23 Мая 2016

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

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    private void sendCommand(Hi1Command command)
            {
                var aCommand = command as Hi1Command;
                ...
            }

    На случай если Microsoft откажется от строгой типизации С#

    RdlSheetCoder, 18 Мая 2016

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

    +1

    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
    <?php
      
      /*
        > 60 seconds - "s"
        > 60 minutes - "m"
        > 24 hours   - "h"
        > 30 days    - "d"
        < 30 days    - "5 sep 2010"
      */
      
      class Date {
        
        public static function DateAgo($DateTime) {
          
          $s = s; $m = m; $h = h; $d = d;
    
          $Now = date('Y-m-d H:i:s');
          $Now = time();
    
          $Year   = substr($DateTime, 0, 4);
          $Month  = substr($DateTime, 5, 2);
          $Day    = substr($DateTime, 8, 2);
          $Hour   = substr($DateTime, 11, 2);
          $Minute = substr($DateTime, 14, 2);
          $Second = substr($DateTime, 17, 2);
    
          $Time = mktime($Hour, $Minute, $Second, $Month, $Day, $Year);
          
          $Difference = $Now - $Time;
          
          if($Difference < 60) {
            $Ago = $Difference.$s;
          } elseif($Difference < (60 * 60)) {
            $Ago = floor($Difference / 60).$m;
          } elseif($Difference < (60 * 60 * 24)) {
            $Ago = floor($Difference / (60 * 60)).$h;
          } elseif($Difference < (60 * 60 * 24 * 30)) {
            $Ago = floor($Difference / (60 * 60 * 24)).$d;
          } else {
            $Ago = $Day.'.'.$Month.'.'.$Year;
          }
          
          return $Ago;      
        }
        
      } // End class
      
    ?>

    Забирайте целиком! Нашёл в CMS от http://fn85.ru/ охрененный класс для работы с датами!

    nik757, 18 Мая 2016

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

    +1

    1. 1
    2. 2
    3. 3
    // $r[2] = 1080;
    $timeStart = (strlen(floor($r[2] / 60)) == 1 ? "0" . floor($r[2] / 60) : floor($r[2] /
                                           60)) . ":" . (strlen($r[2] % 60) == 1 ? "0" . $r[2] % 60 : $r[2] % 60);

    Превращаем минуты во время в формате H:i by ©senior shaurma developer

    pahhan, 05 Мая 2016

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

    −1

    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
    if (!function_exists('printr')) {
            function printr($array) {
                    GLOBAL $USER;
                    if (!$USER->IsAdmin()) return false;
                    $args = func_get_args();
                    if (count($args) > 1) {
                            foreach ($args as $values)
                                    printr($values);
                    } else {
                            if (is_array($array) || is_object($array)) {
                                    echo "<pre>";
                                    print_r($array);
                                    echo "</pre>";
                            } else {
                                    echo $array;
                            }
                    }
                    return true;
            }
    }
    printr($arr1,$arr2, $str, "string");

    Битрикс. Собственный уникальный print_r c Машанями и Медведем. Видио о существовании xdebug адепты bitrix не догадываются.

    http://b.pages.org.ua/php_interface/2011/03/03/universalnyy-print_r-dlya-bitriksa.html

    Keeper, 05 Мая 2016

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