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

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

    +40

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    try {
    	$id = $faq->addQuestion($_POST);
    } catch (FaqException $e) {
    	die('Хуй знает что творится... Вбрасывания нет, екзепшн вылез...');
    }

    guest, 24 Декабря 2008

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

    +27

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    function getData ( $id )
    {
     if( intval( $id ) ) {
      ...
      return $result;
     }
     
     return false;
     echo "Сука блять хуй пиздец!!";
    }

    guest, 24 Декабря 2008

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

    −567.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    do {
    
    	t_year++;
    
    	Length_periods[i]++;
    
    
    } while (t_year<=Periods_end);

    А вам слабо!?

    guest, 21 Декабря 2008

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

    +25

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    elseif( $manufacturer_id) {
    		$db->query( "SELECT manufacturer_id, mf_name FROM #__{vm}_manufacturer WHERE manufacturer_id='$manufacturer_id'");
    		$db->next_record();
    		$mainframe->setPageTitle( $db->f("mf_name") );
    		echo "Izdeliya ot";
    	}

    guest, 20 Декабря 2008

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

    −48

    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
    private static final String PROMPT = " >";
    private static final int BUFFER_SIZE = 255;
    private static final int NEW_LINE_CHAR = 13;
    private static final int CARRIAGE_RETURN_CHAR = 10;
    ...
    System.out.print( prompt + PROMPT );
    StringBuffer sb = new StringBuffer();
    byte[] buf = new byte[BUFFER_SIZE];
    int read = System.in.read( buf );
    if ( read != 0 && buf[0] != CARRIAGE_RETURN_CHAR && buf[0] != NEW_LINE_CHAR )
    {
        sb.append( new String( buf, 0, read ).trim() );
    }
    return sb.toString();

    Вам нужно вывести приглашение и прочитать введенную строку? Что может быть проще?

    guest, 20 Декабря 2008

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

    −40.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
    /* This is bad. Reaaly bad. It's a really, really bad hack. If you're an employee of 
     * Intertrode Communication, then I'm really, really sorry that you have to maintain
     * this. I was honestly planning on removing this tomorrow, but I've been known to 
     * forget things like this. It happens.
     *
     * So here's the thing. I can't seem to figure out why the AccountId variable isn't 
     * set. I've looked and looked, but I gotta leave now. Anyway, I've found that I can
     * just grab the AccountID from the debugging logs.  I suppose that to fix it, you'd
     * have to locate where it's clearing out the ID.
     *
     * Again, I'm sorry.
     */
    
    if ( (AccountId == NULL) || (AccountId == "") ||
         (ServerSesion["AccountId"] == NULL) || (ServerSesion["AccountId"] == "") )
    {
      //open session logs
      FileHandle file = f_open(LOG_PATH + "\sessionlog-" + LOG_FILE_DATE + ".log", 1);
      while (file != NULL)
      {
        
        TString line = f_readline(file);
    
        //look for IP and changereg
        if ( (sfind(line,REMOTE_ADDR) != -1) && (sfind(line,"changereg") != -1) )
        {
          //0000-00-00 00:00 /accountmaint/changereg/?AccountId=123456 255.255.255.255 ...
          //                                                    *
          AccountId = substr(line, 52, 6);
        }
    
        if (f_EOF(file)) { f_close(file); file = NULL; }
      }
    
    }

    У чувака где то перетирается AccountId, так он берет данные из логов IIS'а :) Главное, что он сожалеет об этом.
    Отсюда: http://thedailywtf.com/Articles/The_Apologetic_Coder.aspx

    guest, 18 Декабря 2008

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

    +25

    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
    var res = document.getElementById("result");
    	
    	var data = eval('(' + result + ')');
    	var text = data.status;
    	
    	while (res.firstChild)
    		res.removeChild(res.firstChild);
    	
    	res.appendChild(document.createTextNode(data.status));
    	
    	for (var i = 0; i < data.result.length; i++)
    	{
    		res.appendChild(document.createElement("br"));
    		res.appendChild(document.createTextNode(data.result[i]));
    	}

    guest, 16 Декабря 2008

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

    +27

    1. 1
    2. 2
    volumes = new List<VolumeInformation>(ServerTypedProxy.GetUnfilteredVolumeInformationList())
                    .ConvertAll<BindableVolumeInfo>(delegate(VolumeInformation vi) { return new BindableVolumeInfo(vi); });

    Из разряда попробуй отдебажь
    [Ф]

    guest, 16 Декабря 2008

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

    +28.7

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    function table_exists($table) {
               self :: query("show tables from ".DB_NAME);
               for ($i = 0; $i < self :: num(); $i++) {
                   $res = mysqli_fetch_array($this -> result);
                   if ($res[0] == DB_PREFIX . $table) {
                       return true;
                   }
               }
                   return false;
           }

    guest, 16 Декабря 2008

    Комментарии (2)
  11. C# / Говнокод #188

    +25

    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
    DateTime startTime = DateTime.Now;
    DateTime endTime = DateTime.Now;
    foreach (BillablePhas bi in CreateBillablePhaseForFixedPrice.Phases)
    {
      if (BillablePhase.Equals(bi))
      {
        errorLbl.Visible = true;
        savedLbl.Visible = false;   
                      
        TimeSpan spread = endTime - startTime; //пик быдлокода
        bi.RatioSpredDateTime = Math.Ceiling(Convert.ToDouble(spread.Days*bi.Ratio/100));
      }
    }

    endTime - startTime АААА!!!

    guest, 15 Декабря 2008

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