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

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

    +144

    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
    var cooker = {
    	set: function(cookie_name, cookie_value, cookie_expires, cookie_path, cookie_domain, cookie_secure) {
    		if(cookie_name!==undefined) {
    			cookie_expires=cookie_expires || 0;
    			var expire_date = new Date;
    			expire_date.setTime(expire_date.getTime() + (cookie_expires*1000));
    			document.cookie = cookie_name + "=" + escape(cookie_value)+'; ' + 
    			((cookie_expires === undefined) ? '' : 'expires=' + expire_date.toGMTString()+'; ') +
    			((cookie_path === undefined) ? 'path=/;' : 'path='+cookie_path+'; ') +
    			((cookie_domain === undefined) ? '' : 'domain='+cookie_domain+'; ') +
    			((cookie_secure === true) ? 'secure; ' : '');
    		}
    	},
    	get: function(cookie_name) {
    		var cookie = document.cookie, length = cookie.length;
    		if(length) {
    			var cookie_start = cookie.indexOf(cookie_name + '=');
    			if(cookie_start != -1) {
    				var cookie_end = cookie.indexOf(';', cookie_start);
    				if(cookie_end == -1) {
    					cookie_end = length;
    				}
    				cookie_start += cookie_name.length + 1;
    				return unescape(cookie.substring(cookie_start, cookie_end));
    			}
    		}
    	},
    	erase: function(cookie_name) {
    		cooker.set(cookie_name, '', -1);
    	},
    	test: function() {
    		cooker.set('test_cookie', 'test', 10);
    		var work = (cooker.get('test_cookie') === 'test') ? true : false;
    		cooker.erase('test_cookie');
    		return work;
    	}
    };

    Stealth, 22 Августа 2013

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

    +144

    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
    show: function () {
    		this.number_x++;
    		if(this.number_x-1>=this.frames_x) {
    			this.number_x=1;
    			this.number_y++;
    			if(this.number_y-1>=this.frames_y) {
    				this.number_y=1;
    				if(this.playandstop) {
    					this.stop();
    				}
    			}
    		}
    		if(this.key) {
    			var left;
    			var top;
    			(this.reverse)?left=(this.frames_x-this.number_x)*this.frame_x:left=(this.number_x-1)*this.frame_x;
    			(this.reverse)?top=(this.frames_y-this.number_y)*this.frame_y:top=(this.number_y-1)*this.frame_y;
    			$$(this.id).$$('marginLeft',''+-left+'px').$$('marginTop',''+-top+'px');
    			var th = this;
    			this.timer=setTimeout(function () { th.show(); },this.speed);
    		}
    		else {
    			this.next();
    		}
    	},

    фреймы: такие фреймы

    Stealth, 22 Августа 2013

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

    +144

    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
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    (function() {
    	var appBase = function( appId ) {
     		appId = appId || Math.floor( Math.random() * ( 1000 - 1 ) + 1 );
     		this.stack = {
     			methods: [ ],  extends: { },
     			init: function( cfg ) {
     				this.creator( cfg );
    				this.bootstrap();
     			},
    			bootstrap: function() {
    				this.methods.init = null;
    				var param = new Object();
     				param.app = this.methods, 
    				param.opt = this.setup;
    				param.__proto__ = null;
    				for( var i in this.setup.inits ) {
    					this.methods[ this.setup.inits[i] ].apply( param );
    				};	
    			},
    			creator: function( cfg ) {
    				for( var mtd in cfg ) {
     					var flag = cfg[ mtd ].options[ 1 ] || null,
    						name = cfg[ mtd ].options[ 0 ] + "",
    						func = cfg[ mtd ].func;
    					this.methods[ name ] = func;
    					this.methods[ name ].name = name;
    					if( flag ) {
     					flag = flag.split('|');
    						if( flag[0] ) {
    							switch( flag[0] ) {
    								case 'init': this.setup.inits.push( name ); break;
    								case 'defer': 
    									this.setup.defer.push( name );
    									this.setupTimer( [ flag[ 1 ], name, flag[ 2 ] - 0 ] );
    								break;
    							};
    						};
    					};
    				};
    			},
    			setupTimer: function( opt ) {
     				var tf = this.setup.timer[ opt[1] ],
    					tt = this.methods[ opt[1] ],
    					tm = opt[ 2 ] || 500;
     				switch( opt[0] ) {
    					case 'interval': tf = setInterval( tt, tm ); break; 
    					case 'timeout':  tf = setTimeout( tt, tm ); break;
    				};
     
    			},
    			flushTimer: function( id ) {
    				clearInterval( this.setup.defer[ id ] );
    				console.log( 'Interval '+ id +' Stoped!');
    			},
    			setup: {
    				appId: 'BiO Kernel' + appId, param: [ ], inits: [ ], defer: [ ],timer: [ ], flags: { }
    			}
    		};
    		this.stack.__proto__ = null; this.__proto__ = null;
    	};
    		var application = new appBase();
    		var	app = application.stack;
    		var cfg = [
    			{ 
    				func: function() {
    					console.log( 'RUN [mtd_1] AT [init stage] => force [mtd_3]' );
    					this.app['mtd_3'].apply(this);
    				},
    				options: [ 'mtd_1' , 'init' ]
    			},
    			{ 
    				func: function() {
    					console.log( 'RUN [mtd_2] AT [init stage]' );
    				},
    				options: [ 'mtd_2' , 'init' ]
    			},
    			{ 
    				func: function() {
     
    					console.log( 'RUN [mtd_3] BY [mtd_1] FROM [init stage]' );
    				},
    				options: [ 'mtd_3' ]
    			},
    			{ 
    				func: function() {
    					console.log( 'run defered method #1 in timeout' );
    				},
    				options: [ 'deferedMethod_1', 'defer|timeout|8500' ]
    			},
    			{ 
    				func: function( ) {
    					console.log( 'run defered method #2 in interval' );
    				},
    				options: [ 'deferedMethod_2', 'defer|interval|500' ]
    			},
    		];
    		app.init( cfg, true ); 
    })();

    Съебаться из страны не получилось ): Оно не взламывалось вообще ... лимон так и не дали, а в жопу выебали через кого-то.

    Stealth, 09 Августа 2013

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

    +144

    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
    function coolSerialize(object) {
       
        var result;
    
        if (object instanceof Array) {
            result = [];
            for (var i in object) {
                result[i] = coolSerialize(object[i]);
            }
        } else if (object instanceof Object) {
            result = {};
            var fields = null;
    
            if (object.serializableFields) {
                fields = object.serializableFields;
            }
            else if (object.constuctor && object.constuctor.serializableFields) {
                fields = object.constuctor.serializableFields;
            }
    
            if (fields) {
                for (var i = 0, len = fields.length; i < len; ++i) {
                    var fieldName = fields[i];
                    var o = object[fieldName];
                    
                    result[fieldName] = coolSerialize(o);
                }
            } else {
                for (var fieldName in object) {
                    result[fieldName] = coolSerialize(object[fieldName]);
                }
            }
        } else {
            result = object;
        }
    
        return result;
    }

    Сишнику пришел звиздец, засветился, Молодец! (:

    Stealth, 08 Августа 2013

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

    +144

    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
    $( '.video', tl ).each( function() {
    
                        if( this.id !== target ) {
                            
                            // get other objects props
                            var snaper = $(this);
                            var left   = getLeft( snaper );
                            var swidth = snaper.width();
    
                            // calculate snap positions
                            var leftSpan  = left + swidth;
                            var rightSnap = cPos + swidth; 
    
                            // if snap performed
                            if( cPos === leftSpan || rightSnap === left ) { 
                                
                                var mouse = getMouse( event, floater ); 
                                var shift = 5;                           
    
                                // if cursor goes out snaped object
                                if( shift === ( -1 * mouse ) || mouse === shift + swidth ) {   
    
                            
                                // difference in sizes
                                var diff = ( (fwidth - swidth) > 0 ) ? fwidth - swidth : swidth - fwidth;
    
                                    // setup new positions
                                    var fl = getLeft( floater );
                                    var sl = getLeft( snaper );
    
                                    // fix smaller position 
                                    if( fwidth > swidth ) {
                                        fl += diff;  
                                    } else {
                                        sl += diff;
                                    }
    
                                    // apply overlay to prevent blinking "dragable"
                                    var overlay = $('<div id="overlay"></div>');
                                    $('body').append(overlay);
                                    $('#overlay').focus();
       
                                    // reverse animation dock object
                                    snaper.animate({'left': fl}, 1000);
    
                                    // reverse animation floater
                                    floater.animate({'left': sl}, 1000,
                                    function(){
                                        // unset overlay
                                        $('#overlay').remove();
                                        // return focus to floater object
                                        floater.focus();
                                    });
    
    
                                }                                                             
    
                            }                     
                        }
    
                    });

    Обозвали лисповским червяком … Че сделать с плавной геометрической инверсией?

    Stealth, 08 Августа 2013

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

    +144

    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
    (function(){
     
    	var ToDoList = {
     
    		targets: {
    			dasha:   [ 'Dasha' , 21 , 'female' ],
    			masha:   [ 'Masha' , 32 , 'female' ],
    			vasya:   [ 'Vasily' , 43 , 'male' ],
    			oksana:  [ 'Oksana' , 13 , 'female' ],
    			volodya: [ 'Vladimir' , 68 , 'male' ],
    			olesya:  [ 'Olesya' , 25 , 'female' ],
    			irina:   [ 'Irina' , 34 , 'female' ],
    			olga:    [ 'Olga' , 17 , 'female' ],
    		},
    		chpokedList: [],
    		chpock: function() {
     
    			for( var i in this.targets ) {
     
    				if( this.testChpokableProps( this.targets[i] ) ) {
    					console.log( this.targets[i][0] )
    						this.chpokedList[i] = this.targets[i][0];
    						console.log( 'chpock was success with ' + this.targets[i][0] );		
    				}			
    			}
    		},
    		testChpokableProps: function( subj ) {
     
    			if ( subj[2] !== 'male') {
     
    				return ( subj[1] >= 18 && subj[1] <= 38 ) ? true : false;
     
    			}
     
    		}
    	};
    	var Test = new function() {
    		this.Go = ToDoList;
    	};
    	Test.Go.chpock();
     
    })();
    
    
    
    	var Test = new function() {
    		this.Go = ToDoList;
    	};
    	Test.Go.chpock();

    Меня прокляли, что сделать?

    Stealth, 08 Августа 2013

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

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    ;(function ($) {
    
    // alias Math methods - used a lot!
    var	min		= Math.min
    ,	max		= Math.max
    ,	round	= Math.floor

    lol

    wvxvw, 06 Августа 2013

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

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    class Model_Task extends Model_Base {
        const STATUS_CHECK = 0;
        const STATUS_REWORK = 1;
        const STATUS_COMPLETED = 2;
        const STATUS_INVALID = 99999;
    ...

    Видимо чтобы всегда последним был в случае чего...

    invision70, 20 Июня 2013

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

    +144

    1. 1
    sk = e.shiftKey?e.shiftKey:((kc == 16)?true:false);

    Кэп с нами.

    Daiver, 27 Мая 2013

    Комментарии (355)
  11. PHP / Говнокод #12942

    +144

    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
    <?php
    $db=$_COOKIE['db'];
    $tbn=$_REQUEST['tb_s'];
    include('conf.php');
    mysql_select_db($db);
    echo '<h4 class="nr">'.$db.'.'.$tbn.'</h4><hr>';
    $q=mysql_query("SHOW COLUMNS FROM ".$tbn."");
    echo "<table border='1' class='t'><tr>";
    while($ntb=mysql_fetch_row($q)){
    echo "<td class='gr'>".$ntb['0']."</td>";
    }
    echo '</tr>';
    $query=mysql_query("SELECT * FROM ".$tbn."");
    while($row=mysql_fetch_array($query)){
    $qq=mysql_query("SHOW COLUMNS FROM ".$tbn."");
    echo '<tr>';
    while($ntb=mysql_fetch_row($qq)){
    $u=$ntb[0];
    echo '<td>'.$row[$u].'</td>';
    }
    echo '</tr>';
    }
    echo '</table><hr>';
    echo"<a href='s_db.php?db_s=".$_SESSION['db']."'>Bepнyтcя к тaблицaм</a>";
    ?>

    Мой дебют здесь)оцените говнокодность,+комменты))

    AnalgiNNN, 27 Апреля 2013

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