1. Python / Говнокод #9502

    −178

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    cursor.execute(bla)
    count = cursor.fetchone()
    
    if count[0] > 0 or True:
        cursor.execute(bla)

    ragzovkii, 21 Февраля 2012

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

    +172

    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
    $var=trim($var);
    $var=str_replace("\t", ' ',$var);
    $var=str_replace("\r", ' ',$var);
    $var=str_replace("\n", ' ',$var);
    $var=str_replace('          ', ' ',$var);
    $var=str_replace('         ', ' ',$var);
    $var=str_replace('        ', ' ',$var);
    $var=str_replace('       ', ' ',$var);
    $var=str_replace('      ', ' ',$var);
    $var=str_replace('     ', ' ',$var);
    $var=str_replace('    ', ' ',$var);
    $var=str_replace('   ', ' ',$var);
    $var=str_replace('  ', ' ',$var);
    $var=str_replace('  ', ' ',$var);
    $var=str_replace('  ', ' ',$var);
    $var=str_replace('  ', ' ',$var);
    $var=str_replace('  ', ' ',$var);
    $var=str_replace('  ', ' ',$var);
    $var=str_replace('  ', ' ',$var);

    Надежно, чо.

    velosipedistorg, 21 Февраля 2012

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

    +163

    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
    fadeOutAnimate($("#bigsun"), 500);
                fadeInAnimate($("#littlesun"), 500, function(){
                    fadeInAnimate($("#point1"), 300, function(){
                        fadeInAnimate($("#point2"), 300, function(){
                            fadeInAnimate($("#point3"), 300, function(){
                                fadeInAnimate($("#point4"), 300, function(){
                                    fadeInAnimate($("#point5"), 300, function(){
                                        fadeInAnimate($("#point6"), 300, function(){
                                            fadeInAnimate($("#point7"), 300, function(){
                                                fadeInAnimate($("#point8"), 300, function(){
                                                    fadeInAnimate($("#arrows"), 600, function(){
                                                        fadeInAnimate($("#direction1"), 300, function(){
                                                            fadeInAnimate($("#direction2"), 300, function(){
                                                                fadeInAnimate($("#direction3"), 300, function(){
                                                                    fadeInAnimate($("#direction4"), 300, function(){
                                                                        fadeInAnimate($("#direction5"), 300, function(){
                                                                            fadeInAnimate($("#direction6"), 300, function(){
                                                                                fadeInAnimate($("#direction7"), 300, function(){
                                                                                    fadeInAnimate($("#direction8"), 300, function(){
                                                        
                                                                                    });
                                                                                });
                                                                            });
                                                                        });
                                                                    });
                                                                });
                                                            });
                                                        });
                                                    });
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });

    Анимация.

    fixxxerrr, 21 Февраля 2012

    Комментарии (26)
  4. Pascal / Говнокод #9499

    +87

    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
    procedure makeWord(var str : string; var word : string);
    var j, p,tp : integer;
    begin
    	j:= 1;
    	p := pos(' ', str);
    	if (p = 0) then p:= length(str);
    	word := copy(str, 0, p);
    	delete(str, 0, p);
    	while (str[j] = ' ') or (str[j] = ''#9'') do begin
    		Inc(j);
    	end;
    	if (j > 0) then begin 
    		delete(str,0,j-1);
    	end;
    end;
    	
    var		i,p,n : integer;
    			str, word : string;
    begin
    	str := 'I   		 want to   tell   you!';
    	readln(n);
    	for i:= 1 to n do begin
    		makeWord(str,word);
    		writeln(word);
    	end;
    	readln;
    end.

    Программа выводит первые n слов строки

    ckiD, 21 Февраля 2012

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

    +154

    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
    private function incrementKey ( $key ) {
    			
    	// цепочка знаков в системе счисления
    	$sys = array_merge( range(0, 9), range('a', 'z') );
    			
    	$newKey = '';
    			
    	while( true ) {
    
    		// получаем последний символ
    		$sym = substr($key, -1);
    		$key = substr($key, 0, -1);
    					
    		if ( $sym ) {
    
    			//"инкрементируем" его
    			$cur = array_search( $sym, $sys );
    
    			if ( isset( $sys[++$cur] ) ) {
    				// всё, конец.
    				$newKey = $key . $sys[$cur] . $newKey;
    				break;
    
    			} else $newKey = $sys[0] . $newKey;
    							
    		} else {
    						
    			$newKey = $sys[0] . $newKey;
    			break;
    		}
    	}
    			
    	return $newKey;
    }

    Свежатинка

    bot-minurast, 20 Февраля 2012

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

    +24

    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
    function on_record(status)
    {
    	// Ext.MessageBox.prompt('Name', 'Please enter your name:', 1);
    	var label = form2label();
        if(label['answers'][10]==1&&label['start']=='1970-01-01 03:00:00'&&label['order_num']!='1'){
            label['start'] = get_starttime_mysql();
        }
        else if(label['answers'][10]==2&&label['start']=='1970-01-01 03:00:00'){
            label['start'] = get_finishtime_mysql();
        }
    	label['status'] = status;
    	save_label(label);
    
    }

    превед.

    brainstorm, 20 Февраля 2012

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    //*****************************************************************************
    //************** ВНИМАНИЕ! ДАЛЬШЕ ИДЕТ СТРАШНЫЙ СТАРЫЙ КОД! *****************
    //**************** ОДЕНЬТЕ СКАФАНДР ПРИ ВХОДЕ В ЭТУ ЗОНУ! *******************
    //*****************************************************************************

    http://habrahabr.ru/js/1329490138/system.js

    kafeman, 20 Февраля 2012

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

    +159

    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
    // Конструктор
        public function __construct($tablename,
                                    $detal = "*",
                                    $where,
                                    $order = "",
                                    $pnumber = 10,
                                    $page_link = 3,
                                    $parameters = "")
        {
            if (empty($detal)) $this->detal = '*'; else $this->detal = $detal;
            parent::__construct($tablename,
                $where,
                $order,
                $pnumber,
                $page_link,
                $parameters);
        }

    ооп

    englandpost, 20 Февраля 2012

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

    +159

    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
    <?php  if (!($main_controller->params['id_type'] == 3  
     && in_array($id_seo, array(70,76,92,78,121,163,165,278,164))) 
    && $main_controller->params['id_cat']!=12 && $main_controller->params['id_cat']!=11 
    && $main_controller->params['id_type'] != 6 
    && !($id_type==5 && $id_elt==6 
    && isset($main_controller->params['id_prep'])) 
    && $id_seo!=140 && !($main_controller->params['id_type'] == 1 
    && ($id_elt==76 || ($id_elt>=82 && $id_elt<=90) ||  in_array($id_seo, array(241,244,245,268,286,287,288,289,237,285,283,284,324)) 
    || in_array($id_elt, array(12,100,101,14,18,19,20,13,93,24,25,26,27,28,29,30,31,32,33,34,43,44,45,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,104,91))))) { ?>
    
    ...
    
     else if($main_controller->params['id_type'] == 1 && ($id_elt==76 || ($id_elt>=82 && $id_elt<=90) 
    || in_array($id_elt, array(12,100,101,14,18,19,20,13,93,24,25,26,27,28,29,30,31,32,33,34,43,44,45,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,104,91))))

    такие вот лаконичнинькие условия (было в одну строку - переносы сам сделал для читабельности))))

    SuperChel, 20 Февраля 2012

    Комментарии (5)
  10. Ruby / Говнокод #9493

    −100

    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
    # ищем позиции в гугле
       def search(request, keyword, p = nil)
          proxy = nil
       # инициализация прокси
          if p # обьект с прокси-серверами
             proxy = "http://#{p.proxy}/" # случайный прокси
             proxy_working = false 
             while not proxy_working
                begin
                   timeout(5) { open(request, :proxy => proxy) }
                rescue Timeout::Error
                   $log.put "bad broxy #{proxy}"
                   proxy = "http://#{p.proxy}/"
                   next
                rescue Errno::ECONNREFUSED
                   $log.put "bad broxy #{proxy}"
                   proxy = "http://#{p.proxy}/"
                   next
                rescue OpenURI::HTTPError
                   $log.put "bad broxy #{proxy}"
                   proxy = "http://#{p.proxy}/"
                   next
                else
                   $log.put "working #{proxy}"
                   proxy_working = true
                end
             end
          end
    # код

    baldrs, 20 Февраля 2012

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