1. Objective C / Говнокод #10117

    −282

    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
    NSArray *beautifulValues = [[NSArray alloc] initWithObjects:
                                    [NSNumber numberWithFloat:0.00001], 
                                    [NSNumber numberWithFloat:0.00005], 
                                    [NSNumber numberWithFloat:0.0001],
                                    [NSNumber numberWithFloat:0.005],
                                    [NSNumber numberWithFloat:0.001],
                                    [NSNumber numberWithFloat:0.005],
                                    [NSNumber numberWithFloat:0.01],
                                    [NSNumber numberWithFloat:0.05], 
                                    [NSNumber numberWithFloat:0.1],
                                    [NSNumber numberWithFloat:0.5],
                                    [NSNumber numberWithFloat:1],
                                    [NSNumber numberWithFloat:5],
                                    [NSNumber numberWithFloat:10],
                                    [NSNumber numberWithFloat:50],
                                    [NSNumber numberWithFloat:100],
                                    [NSNumber numberWithFloat:500],
                                    [NSNumber numberWithFloat:1000],
                                    [NSNumber numberWithFloat:5000],
                                    [NSNumber numberWithFloat:10000],
                                    [NSNumber numberWithFloat:50000],
                                    [NSNumber numberWithFloat:100000],
                                    [NSNumber numberWithFloat:500000],
                                    [NSNumber numberWithFloat:1000000],
                                    [NSNumber numberWithFloat:5000000],
                                    [NSNumber numberWithFloat:10000000], nil];

    Нашел в одном из проектов.

    itruf, 30 Апреля 2012

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (arg4 == 1) {
                $('#FCPDT'+arg3+'__'+arg).remove();
                $('#Fcpdt'+arg3+'___'+arg).remove();
            } else {
                $('#FCPDT'+arg3+'__'+arg).remove();
                $('#Fcpdt'+arg3+'___'+arg).remove();
            }

    O_o

    Hits, 30 Апреля 2012

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

    +18

    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
    //---------------------------------------------------------
    void Link::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
    {
        Q_UNUSED(option);
        Q_UNUSED(widget);
    
    
        if ( mA && mB )
        {
            QPen pen(mColor, mPenWidth);
            painter->setPen(pen);
    
    
            if ( smooth() )
                painter->setRenderHint(QPainter::Antialiasing, true);
    
    
            QString ptname = mA->objectName() + QString("_point%1").arg(mAPoint);
            QDeclarativeItem *aConn = mA->findChild<QDeclarativeItem*>(ptname);
            QDeclarativeItem *bConn = *(QDeclarativeItem**) mB->property("root").constData();
    
    
            QRectF arect(aConn->x() + mA->x() - mB->x(), aConn->y() + mA->y() - mB->y(), aConn->width(), aConn->height());
            QRectF brect(bConn->x(), bConn->y(), bConn->width(), bConn->height());
    
    
            QLineF line(arect.center(), brect.center());
    
    
            painter->drawLine(line);
    
    
            if ( widget )
                widget->update();
       }
    }

    Из коммита где-то в 4:00 :)

    Elvenfighter, 30 Апреля 2012

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

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    <style type="text/css">
    #1{display:<script type="text/javascript">if(NextStrInfo(1) == 1){document.write("block");}else{document.write("none");}</script>;}
    #2{display:<script type="text/javascript">if(NextStrInfo(2) == 1){document.write("block");}else{document.write("none");}</script>;}
    </style>

    Замечено на форуме.

    Nikitian, 29 Апреля 2012

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

    +75

    1. 1
    2. 2
    <input type="text" value="1" id="Count" size="1">
    <a href="<?=$arResult["ADD_URL"]?>" rel="nofollow" onclick="return addToCart(this, 'catalog_detail_image', 'detail', '<?=GetMessage("CATALOG_IN_BASKET")?>');" id="catalog_add2cart_link"><span><img src="/upload/cart.jpg"></span>

    o1eg, 29 Апреля 2012

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

    +141

    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
    <?php
    class GetF {
        var $symbol;
        public function __construct(){
            $this->symbol = 'Ф';
        }
    }
    
    function GetE(){
        return 'е';
    }
    
    function GetL(){
        $L = array('л'=>'Abracadabra');
        return str_replace(array_values($L), array_keys($L), 'Abracadabra');
    }
    
    function GetI($password){
        return $password == 'Please give me I' ? 'и' : 'WTF?';
    }
    
    class GetX extends GetF{
        var $symbol;
        public function __construct(){
            $this->symbol = 'кс';
        }
    }
    $preF = new GetF();
    $F = $preF->symbol;
    $E = GetE();
    $L = GetL();
    $I = GetI('Please give me I');
    $preX = new GetX();
    $X = $preX->symbol;
    
    echo $F.$E.$L.$I.$X;  //БУ парапам пам пам РА парапам пам пам ТИ парапам пам НО парапам пам пам

    My name is....

    Mrxan, 29 Апреля 2012

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

    +110

    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
    private void button6_Click(object sender, EventArgs e)
            {
                string str;
                FileStream fs = new FileStream("file.data", FileMode.Open,FileAccess.Read);
                BinaryReader br = new BinaryReader(fs, Encoding.UTF8);
                try
                {
                    while (true)
                    {
                        str = br.ReadString();
                        listBox1.Items.Add(str);
                    }
                }
                catch { MessageBox.Show("Файл file.data успешно считан", "Успех!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
    
                fs.Close();
                br.Close();
            }

    while (true)-изюминка конечно =)
    а так это из курсовой первокурсницы, так что простительно

    Bagger288, 29 Апреля 2012

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

    −120

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Если НЕ Докум.ПроверенноБухгалтером Тогда
    	ЧихПых = Истина;     // подмена контрагента на НЕПРОВЕРЕНО БУХОМ
    Иначе
    	ЧихПых = Ложь;
    КонецЕсли;

    Вот такой вот фокус от программистов для бухгалтеров.

    koshak84, 28 Апреля 2012

    Комментарии (13)
  9. Java / Говнокод #10072

    +84

    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
    public static String converterMsToTimeString(Long msecond){
    		String result="";
    		if (msecond!=0){
    			long hours =  msecond /(1000*60*60);
    			long minuts =  (msecond % (1000*60*60))/(1000*60);
    			long seconds =  ((msecond % (1000*60*60)) %(1000*60)) / 1000;
    			result = (hours < 10 ? "0" + String.valueOf(hours) : String.valueOf(hours)) + ":" 
    					+ (minuts < 10 ? "0" + String.valueOf(minuts) : String.valueOf(minuts)) + ":"
    						+ (seconds < 10 ? "0" + String.valueOf(seconds) : String.valueOf(seconds));
    			
    		}
    		result=""; // not many
    		return result;
    	}

    Вставлено как есть. Смысл комента ускользает...

    alexcom, 28 Апреля 2012

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

    +79

    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
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    function exeSQL($inSQL,$withDebug = true,$iniDb = '') {
    	global $db;
    	
    	$tmp_db = $db;
    	if ($iniDb != '') {
    		$tmp_db = $iniDb;
    	}
    
    	if (isset($_SESSION['HIDDEN']) and is_numeric($_SESSION['HIDDEN']['HIDDEN']) and $_GET['HIDDEN'] == 'YES') {
    		echo "
    		<br>---------------------------------------------------------------------
    		BEG_TIME: " . date('h:i:s A');
    				print "<pre>";
    				print_r($inSQL);
    		echo "<br>END_TIME: " . date('h:i:s A') . "<br>
    		------------------------------------------------------------------------";		
    	}
    	
    	$result = mysql_query($inSQL, $tmp_db);
    
        $error = mysql_error($tmp_db);
        
        if ($error) {
        	if (strpos($inSQL, 'USD-CODED_RECORD:V') !== false) {
        		$strSQL = util::decodeRecord($inSQL);
        		exeSQL($strSQL, $withDebug);
        		return ;
        	}
        	if ($withDebug) {    
    	   	//	if (!is_dir("d:/temp") and $_GET['debug2'] != 'Y') {
    		 //   	echo file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/index.html');
    		//		die(); 		
    	   	//	}
        			
    	    	echo $error;
    			print "<pre>";
    			print ($inSQL);
    	    	die();    	
        	}
        }
        
        // -- CHECK IF IT WAS INSERTION ---
        
        // -- TRY TO RETURN DATASET
         $arr = @mysql_fetch_array($result);
        // -- NO RESULT AT ALL
        if (is_array($arr)) {
        
    	    // -- RETURN AS VARCHAR ----
    	    if (count($arr) <= 2) return $arr[0];
    	    
    	    // FORM RESULT ARRAY TO RETURN TO USER
    	    $res = array();
    	    while ($arr) {
    	    	$res[] = $arr;
    	    	$arr = mysql_fetch_array($result);
    	    }
    	           
    	    return $res;
        } else {
        	return '';
        	$id = mysql_insert_id($tmp_db);
    		if ($id > 0) {
    		  	return $id;
    		}    	
        }
        
        return '';
    }

    Работа с СУБД.

    nethak, 28 Апреля 2012

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