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

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

    +138

    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
    <?php
    header("Content-Type: text/javascript;charset=utf-8");
     
    $html='';
    #$fp = fopen('counter.txt', 'w+');
     
    if (isset($_GET)) {
        $type=$_REQUEST['type'];
     
     
        if (isset ($_REQUEST['callback'])){
            $html.=$_REQUEST['callback']."(";
        }
     
        $fils=array('ukqs','uk','regions', 'org', 'citiesarhobl', 'cities', 'omsu', 'iogv','fund_uk','standart');
     
        if (isset($_GET['cfund_uk'])) {
            $fund_file='jbase/cities_'.$_GET['cfund_uk'].'.js';
            if (file_exists($fund_file))
                $html.=file_get_contents($fund_file);
            else
                $html.='error:'.$fund_file;
        }
        else
            if (isset($_GET['rfund_uk'])) {
                $fund_file='jbase/'.$_GET['rfund_uk'].'_regions.js';
                if (file_exists($fund_file))
                    $html.=file_get_contents($fund_file);
                else
                    $html.='error';
            }
        if (isset($_REQUEST['uks'])&&($type=='cities')) {
            $fund_file='jbase2/'.$_GET['uks'].'_cities.js';
            if (file_exists($fund_file))
                $html.=file_get_contents($fund_file);
            else
                $html.='error:'.$fund_file;
        }
        else
            if (isset($_REQUEST['uks'])&&($type=='regions')) {
                $fund_file='jbase2/'.$_GET['uks'].'_regions.js';
                if (file_exists($fund_file))
                    $html.=file_get_contents($fund_file);
                else
                    $html.='error';
            }
        else
            if ($type=='standart') {
                $fund_file='standart.js';
                if (file_exists($fund_file))
                    $html.=file_get_contents($fund_file);
                else
                    $html.='error';
            }
        else
        foreach ($fils as $ty)
            if ($ty==$type)
                $html.=file_get_contents($type.".js");    
        if (isset ($_REQUEST['callback']))
        {
            $html.=")";
        }
        #$date=date("F j, Y, g:i a");
       #$test = fwrite($fp, $date."#####\n\r ".$html);
     
        print $html;
        #fclose($fp);
    }
    ?>

    этот файл отдаёт json ajax ответ, подгружая его из *.js файла

    tariel, 14 Августа 2013

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

    +145

    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
    $(function() {
    
    	// hardcore mode
    	"use strict";
    	"use paranoid";
    
    	// todo: string-to-functioName converter and more flexible injector
    	;(function() {
    
    		var ooStack = {
    			writeback: function() {
    
    				// main wrappers
    				var wrappers = $( 'html, body' );
    				var meta     = $( 'head' );
    				var root     = $( '#core' , wrappers );
    				var head     = $( '#head', root );
    				var content  = $( '#content' , root );
    				var sidebar  = $( 'aside' , root );
    				var articles = $( 'article' , content );
    
    				// it can fuck your brain
    				var footway	 = {
    					root: root,
    					head: head,
    					content: content,
    					sidebar: sidebar,
    					articles: articles,
    					wrappers: wrappers,
    
    					// paginator
    					paginator: $( '.pager' , root ),
    				};
    
    				// return stack definition
    				return footway;
    			}
    		};
    
    		// New world
    		var appInstance = new world();
    
    		// Inject selectrors and methods
    		var app = appInstance.application;
    		app.dom = ooStack.writeback();
    
    		// Execute
    		app.init();
    
    	})();
    });

    Распедаль мои копыта -- наебнись мозги козла :D В Оригинале : робоцып, робокоп head и лопата

    Stealth, 09 Августа 2013

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

    +146

    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
    var passedLinks      = new Array();
    
    	for( var lnk = 0; lnk <= aLinksCollection.length; lnk++ ) {
    
    		var AJAXLink = aLinksCollection[ lnk ];
    
    		// exclusions by DOM objects, filter external links and shuffle some extensions
    			if( typeof AJAXLink === 'undefined' ) continue;
    
    			var aLoc  = AJAXLink.href;
    
    			if( AJAXLink.host.match( document.location.host ) &&
    				!self.filters.extensions.test( AJAXLink.pathname ) &&
    				!aLoc.match( self.filters.pathways[0] ) ) {
    
    					passedLinks.push( AJAXLink );
    
    			};
    };
    			
    
    		/* regExps constants */
    		filters: {
    			extensions: /\.(gif|jpg|jpeg|tiff|png|exe|pdf|txt|psd|rss|rdf|cpgz|tar\.gz|rar|zip|html|htm|test|tar|xml|msi|iso|swf)$/i,
    			trapzones: '#id1, #id2, #id3, .class1 pre:last, tags p:last',
    			pathways: [
    				'edit|add|reply|search|rss\.xml|#',
    				'contact|license|about|advertisement'
    			]
    		},

    Выложу сам лучше ... отобрать хотели и сделать тоже самое ;) не серчайте

    Stealth, 09 Августа 2013

    Комментарии (5)
  5. JavaScript / Говнокод #13585

    +146

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $( self.filters.trapzones ).hover(function() {  
    					if( garbage && !garbage.match(similar.id) ) {
    						$.Storage.set('SimNodes', garbage + similar.id + '*');
    						$('#similar').delay(550).show(550);
    					}
    					if( !garbage ) {
    						$.Storage.set('SimNodes', '0*' + similar.id + '*');
    						$('#similar').delay(550).show(550); 
    					}
    
    				});

    String Mach db

    Stealth, 09 Августа 2013

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

    +161

    1. 1
    $papks = scandir($dir, 1);

    Вот есть $files? Значит и $papks тоже бывает.

    deep, 07 Августа 2013

    Комментарии (5)
  7. Куча / Говнокод #13491

    +125

    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
    slowCallPattern (P: P: P: P: P: P: _) = (fsLit "stg_ap_pppppp", 6)
    slowCallPattern (P: P: P: P: P: _) = (fsLit "stg_ap_ppppp", 5)
    slowCallPattern (P: P: P: P: _) = (fsLit "stg_ap_pppp", 4)
    slowCallPattern (P: P: P: V: _) = (fsLit "stg_ap_pppv", 4)
    slowCallPattern (P: P: P: _) = (fsLit "stg_ap_ppp", 3)
    slowCallPattern (P: P: V: _) = (fsLit "stg_ap_ppv", 3)
    slowCallPattern (P: P: _) = (fsLit "stg_ap_pp", 2)
    slowCallPattern (P: V: _) = (fsLit "stg_ap_pv", 2)
    slowCallPattern (P: _) = (fsLit "stg_ap_p", 1)
    slowCallPattern (V: _) = (fsLit "stg_ap_v", 1)
    slowCallPattern (N: _) = (fsLit "stg_ap_n", 1)
    slowCallPattern (F: _) = (fsLit "stg_ap_f", 1)
    slowCallPattern (D: _) = (fsLit "stg_ap_d", 1)
    slowCallPattern (L: _) = (fsLit "stg_ap_l", 1)
    slowCallPattern (V16: _) = (fsLit "stg_ap_v16", 1)
    slowCallPattern [] = (fsLit "stg_ap_0", 0)

    Исходник GHC
    https://github.com/ghc/ghc/blob/master/compiler/codeGen/StgCmmArgRep.hs#L120

    j123123, 27 Июля 2013

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

    +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
    template<class T>
    class E{};
    struct T
    {
        operator E<T>&()
          {static E<T> a; return a;}
          operator const E<T>&() const
          {static E<T> a; return a;}
            T(E<T>&){}
            T(){}
            
            private:
            T(T&);
    };
    int main() {
            T a;
        T b((T()));
        //T c((a));//Если расскомментировать эту строчку, то не скомпилируется, тк T(T&); в private.
            return 0;
    }

    Новая тема для размышлений в пользу убогости крестов:
    http://www.gamedev.ru/flame/forum/?id=178189
    http://ideone.com/ONQPBb

    LispGovno, 09 Июля 2013

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

    +147

    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
    /**
     * Геноцид.
     */
    public function purgeProducts()
    {
    	$command = Yii::app()->db->createCommand();
    	
    	$command->truncateTable('tbl_catalogue_property_value');
    	$command->truncateTable('tbl_catalogue_property_value');
    	$command->truncateTable('tbl_catalogue_product_info');
    	$command->truncateTable('tbl_catalogue_product');
    	$command->truncateTable('tbl_products_to_features');
    	$command->truncateTable('tbl_catalogue_category_to_product');
    	$command->truncateTable('tbl_relation_material');
    }

    Геноцид.

    kukymbr, 09 Июля 2013

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

    +119

    1. 1
    border-color: #dadada #ebebeb #ebebeb #dadada;

    CSS. Встречено в проекте, разработчики с пост-совка :)

    Elvenfighter, 04 Июля 2013

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

    −169

    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
    // Функция возвращает округленное значение общего количества продуктов питания.
    // 
    // Параметры:
    //	Число - число, которое необходимо округлить.
    //	Порядок - число, порядок округления.
    
    Функция УППБУ_Округлить(Число, ПорядокОкругления) Экспорт
    	
    	Порядок = Число(Строка(ПорядокОкругления));
    	
    	..........
    	
    КонецФункции

    Тиражное решение от одного из партнеров...

    HomoAlbus, 02 Июля 2013

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