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

    +118

    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
    private Excel._Application _excel;
    ...
    private void RefreshFormulas(FormulaRefreshOption formulaRefreshOption, object objectToRefresh)
    		{
    			//Где-то в дебрях километрового метода бросилось в глаза
                            ...
    			try
    			{
    				Excel.Range intersection = selection, selection2 = selection;
    				while (selection2 != null)
    				{
    					intersection = _excel.Intersect(selection2, selection2.Dependents,
    						Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    						 Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    						  Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    						   Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
    
    
    					System.Windows.Forms.Application.DoEvents();
    					excelUtilities.RecalculateRangeInstance(true, intersection/*_excel.Selection as Excel.Range*/);
    					selection2 = intersection;
    				}
    
    			}
    			catch (Exception) { /*ignore the exception because .Dependents will throw an exception if there aren't any dependents*/}
                            ...
    		}

    fade, 04 Января 2012

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

    −329

    1. 1
    1

    TarasGovno, 04 Января 2012

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

    +144

    1. 1
    1

    TarasGovno, 04 Января 2012

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

    +145

    1. 1
    1

    TarasGovno, 04 Января 2012

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

    +145

    1. 1
    $var

    TarasGovno, 04 Января 2012

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

    +144

    1. 1
    $

    TarasGovno, 04 Января 2012

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

    +83

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public String getNext() {
        try {
            return items[pointer];
        } finally {
            pointer++;
            if(pointer >= items.length) {
                pointer = 0;
            }
        }
    }

    huitka, 04 Января 2012

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

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    class Mysql_class {
    
      function get_row($query) {
        $sql_query = mysql_query($query) or exit(mysql_error());
        return mysql_fetch_array($sql_query);
      }
    
      function single_query($query) {
        if (mysql_query($query)) return true;
        else return mysql_error();
      }
    }

    2011-й год, прототип класса для работы с базой данных ( http://www.askdev.ru/q/8552 )

    demotivator, 04 Января 2012

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

    +156

    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
    exec(" cd $dir; ls -al|grep '^d';",$file_all);
      	//die(" cd $dir; ls -al|grep '^d';");
      	$filelist_date = array();
      	
      	for($i=0;$i<count($file_all);$i++) {
      		$file_all[$i] = preg_replace('/\s+/','|',$file_all[$i]);
      		
      		$file_all[$i] = explode('|',$file_all[$i],9);
      		if(!empty($file_all[$i][8])) $file_all[$i][8] = str_replace('|',' ',$file_all[$i][8]);
      		
      		//print_r($file_all[$i]); echo "\n\n";
      		if($file_all[$i][8] == '.' || $file_all[$i][8] == '..') continue;
      		
      		$k = strtotime($file_all[$i][5]." ".$file_all[$i][6]." ".$file_all[$i][7]);
      		$filelist_date[$k] = $file_all[$i][8];
      	}
      	krsort($filelist_date);
      	
      	$filelist = array_values($filelist_date);

    этот кусок кода выполняет начитку директорий фото галерей

    kolexander, 04 Января 2012

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

    +1001

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    void Object::destroy ()
    {
      evas_object_del (o);
      
      // do a suicide as the delete operator isn't public available
      // the reason is that the C design below is a suicide design :-(
      //delete (this); // TODO: why does this make problems sometimes???
    }

    source: trunk/BINDINGS/cxx/elementaryxx/src/Object.cpp @ 65926

    rat4, 04 Января 2012

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