├── LICENSE ├── README.md ├── assets └── cover.jpg └── snippets ├── callback-hell.js ├── non-alphanumeric.js ├── pointless-if-statement.js ├── shittify.js └── zhuangbility.js /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Mohaer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## MDZZ: Such a motherfucking idiot 2 | 3 | > Mom, what am I to you? 🙉🙉🙉 4 | 5 | > You are MDZZ. 🌚🌚🌚 6 | 7 | ## Contents 8 | - [Callback Hell](#callback-hell) 9 | - [Non Alphanumeric](#non-alphanumeric) 10 | - [Pointless If Statement](#pointless-if-statement) 11 | - [Shittify](#shittify) 12 | - [Zhuangbility](#zhuangbility) 13 | 14 | ## Callback Hell 15 | 16 | ``` javascript 17 | KDANIMATE.prototype.play = function(){ 18 | this.installBox(); 19 | this.step1(function(){ 20 | this.step2(function(){ 21 | this.step3(function(){ 22 | this.step4(function(){ 23 | this.step5(function(){ 24 | this.step6(function(){ 25 | this.step7(function(){ 26 | this.step8(function(){ 27 | this.step9(function(){ 28 | this.stepN(function(){ 29 | // N + 1 ...... 30 | }); 31 | }); 32 | }); 33 | }); 34 | }); 35 | }); 36 | }); 37 | }); 38 | }); 39 | }); 40 | } 41 | ``` 42 | Source: http://www.kuaidadi.com/assets/js/animate.js - [Snippet](./snippets/callback-hell.js#L82) 43 | 44 | ## Non Alphanumeric 45 | Write any JavaScript with 6 Characters: `[]()!+` 46 | ``` javascript 47 | // Source 48 | alert(1) 49 | 50 | // Fucked 51 | [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[ 52 | ]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[] 53 | ])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+ 54 | (!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+ 55 | !+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![ 56 | ]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![] 57 | +[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[ 58 | +!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!! 59 | []+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![ 60 | ]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[ 61 | ]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![ 62 | ]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(! 63 | []+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[]) 64 | [+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+[+!+[]]+( 65 | !![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[ 66 | ])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])() 67 | ``` 68 | Source: https://github.com/aemkei/jsfuck - [Snippet](./snippets/non-alphanumeric.js) 69 | 70 | One more style: [aaencode](http://utf-8.jp/public/aaencode.html), encode any JavaScript program to Japanese style emoticons (^_^) 71 | 72 | ## Pointless If Statement 73 | ``` javascript 74 | // Eew 75 | return kRegex.test(value); 76 | 77 | // Beautified 78 | if (kRegex.test(value)) { 79 | return true; 80 | } else { 81 | return false; 82 | } 83 | ``` 84 | Source: http://uglyjs.github.io/2011/09/07/pointless-if - [Snippet](./snippets/pointless-if-statement.js) 85 | 86 | ## Shittify 87 | So you can honestly say your code is full of shit. 88 | 89 | ``` bash 90 | $ ./bin/shittifyjs -m 91 | 92 | (function () { 93 | var a = 'this'; 94 | var b = 'code'; 95 | var c = 'is a pile'; 96 | var d = 'of shit'; 97 | return a + b + c + d; 98 | })() 99 | 100 | (function(){var💩="this";var💩💩="code";var💩💩💩="is a pile";var💩💩💩💩="of shit";return💩+💩💩+💩💩💩+💩💩💩💩})(); 101 | ``` 102 | Source: https://github.com/alexkuz/shittify-js - [Snippet](./snippets/shittify.js) 103 | 104 | ## Zhuangbility 105 | 106 | ``` javascript 107 | // Boolean 108 | !!'fuck' 109 | 110 | // ParseInt 111 | ~~3.14159 === parseInt(3.14159) 112 | 113 | // Hex 114 | (~~(Math.random()*((1<<24)-1))).toString(16)+'00000').substring(0,7) 115 | 116 | // << 117 | parseInt('1000000000000000000000000', 2) === (1 << 24) 118 | Math.pow(2,24) === (1 << 24) 119 | ``` 120 | Source: https://segmentfault.com/a/1190000004972445 - [Snippet](./snippets/zhuangbility.js) 121 | 122 | ## Contributing 123 | Any shit is welcome here, fell free to open a PR : ) 124 | -------------------------------------------------------------------------------- /assets/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mohaer/MDZZ/590ece2d7430d0431b3d0d70ba3831bfcd2988e4/assets/cover.jpg -------------------------------------------------------------------------------- /snippets/callback-hell.js: -------------------------------------------------------------------------------- 1 | // JavaScript Document 2 | (function($){ 3 | var KDANIMATE = function(){ 4 | this.p = 10; 5 | this.z = 6; 6 | this.ps = []; 7 | this.zs = []; 8 | this.box = $('#playbox'); 9 | this.phoneBox = this.box.find('.phonebox'); 10 | this.clientBox = this.box.find('.clientbox'); 11 | this.phoneWindow = this.box.find('.phonebox .phonebox-window'); 12 | this.title = this.clientBox.find('.title'); 13 | this.info = this.clientBox.find('.info'); 14 | this.showImage = this.clientBox.find('.show-image'); 15 | this.tipTop = this.box.find('.tip-top'); 16 | this.tipBot = this.box.find('.tip-bot'); 17 | this.finger = this.box.find('.finger'); 18 | this.delaytime = 3000; 19 | this.install(); 20 | this.tmp = null; 21 | }; 22 | 23 | KDANIMATE.prototype.loadSingleImage = function(type, url, callback){ 24 | var image = new Image(), 25 | that = this; 26 | image.onload = image.onerror = function(){ 27 | that[type + 's'].push(this); 28 | callback(); 29 | }; 30 | image.src = url; 31 | }; 32 | 33 | KDANIMATE.prototype.loadImages = function(type, i, callback){ 34 | if ( i < this[type] ){ 35 | var that = this; 36 | this.loadSingleImage(type, '/assets/animate/' + type + (i + 1) + '.png', function(){ 37 | that.loadImages(type, i + 1, callback); 38 | }); 39 | }else{ 40 | callback(); 41 | } 42 | } 43 | 44 | KDANIMATE.prototype.installBox = function(){ 45 | var that = this; 46 | this.clientBox.css('zIndex', '1'); 47 | this.box.css({ position: 'relative' }).parent().css('padding-top', '100px'); 48 | this.phoneBox.css({ 49 | width: '501px', 50 | height: '820px', 51 | background: "url('/assets/animate/p1.png')", 52 | position: 'relative', 53 | zIndex: '2' 54 | }); 55 | this.phoneWindow.css({ 56 | width: '261px', 57 | height: '460px', 58 | background: '#fff', 59 | position: 'absolute', 60 | top: '91px', 61 | left: '214px' 62 | }); 63 | this.title.css({ 64 | 'text-align': 'center', 65 | color: '#444444', 66 | 'font-size': '56px' 67 | }); 68 | this.info.css('height', '150px'); 69 | $(window).on('resize', function(){ 70 | var width = $('.container').outerWidth(); 71 | that.clientBox.css('width', (width - 501 - 30) + 'px'); 72 | }).trigger('resize'); 73 | } 74 | 75 | KDANIMATE.prototype.delay = function(callback, speed){ 76 | var that = this; 77 | setTimeout(function(){ 78 | callback.call(that); 79 | }, speed || this.delaytime); 80 | } 81 | 82 | KDANIMATE.prototype.play = function(){ 83 | this.installBox(); 84 | this.step1(function(){ 85 | this.step2(function(){ 86 | this.step3(function(){ 87 | this.step4(function(){ 88 | this.step5(function(){ 89 | this.step6(function(){ 90 | this.step7(function(){ 91 | this.step8(function(){ 92 | this.step9(function(){ 93 | this.step10(function(){ 94 | this.step11(function(){ 95 | this.step12(function(){ 96 | this.step13(function(){ 97 | this.step14(function(){ 98 | this.step15(function(){ 99 | this.step16(function(){ 100 | this.step17(function(){ 101 | var that = this; 102 | setTimeout(function(){ 103 | that.showImage.empty(); 104 | that.info.css('height', '150px'); 105 | that.play(); 106 | }, 6000); 107 | }); 108 | }); 109 | }); 110 | }); 111 | }); 112 | }); 113 | }); 114 | }); 115 | }); 116 | }); 117 | }); 118 | }); 119 | }); 120 | }); 121 | }); 122 | }); 123 | }); 124 | } 125 | 126 | KDANIMATE.prototype.step1 = function(callback){ 127 | 128 | this.phoneWindow.css({ 129 | background: "url('/assets/animate/z1.png')" 130 | }); 131 | this.title.html('多种叫车方式'); 132 | this.showImage.append(this.ps[1]); 133 | 134 | callback.call(this); 135 | } 136 | 137 | KDANIMATE.prototype.step2 = function(callback){ 138 | this.delay(function(){ 139 | this.finger.show().css({ 140 | background: "url('/assets/animate/p3.png')", 141 | width: '419px', 142 | height: '334px', 143 | position: 'absolute', 144 | bottom: '0px', 145 | left: '200px', 146 | zIndex: '99' 147 | }); 148 | 149 | callback.call(this); 150 | }); 151 | } 152 | 153 | KDANIMATE.prototype.step3 = function(callback){ 154 | this.delay(function(){ 155 | this.phoneWindow.hide('fast'); 156 | this.finger.fadeOut('fast'); 157 | this.info.html('') 158 | callback.call(this); 159 | }, 1000); 160 | } 161 | 162 | KDANIMATE.prototype.step4 = function(callback){ 163 | this.delay(function(){ 164 | this.finger.fadeIn('fast'); 165 | 166 | callback.call(this); 167 | }, 2000); 168 | } 169 | 170 | KDANIMATE.prototype.step5 = function(callback){ 171 | this.delay(function(){ 172 | this.phoneWindow.show('fast'); 173 | this.finger.fadeOut('fast'); 174 | callback.call(this); 175 | }, 1000); 176 | } 177 | 178 | KDANIMATE.prototype.step6 = function(callback){ 179 | var that = this; 180 | this.delay(function(){ 181 | this.finger.fadeIn('fast', function(){ 182 | $(this).animate({ 183 | left: '300px' 184 | }, 'fast', function(){ 185 | callback.call(that); 186 | }); 187 | }); 188 | }, 500); 189 | } 190 | 191 | KDANIMATE.prototype.step7 = function(callback){ 192 | this.delay(function(){ 193 | this.phoneWindow.css({ 194 | background: "#fff url('/assets/animate/z2.png')" 195 | }); 196 | this.finger.fadeOut('fast'); 197 | this.tipTop.show().css({ 198 | background: "url('/assets/animate/p4.png')", 199 | width: '342px', 200 | height: '244px', 201 | position: 'absolute', 202 | left: '335px', 203 | top: '-77px', 204 | zIndex: '98' 205 | }); 206 | this.info.html('') 207 | callback.call(this); 208 | }, 500); 209 | } 210 | 211 | KDANIMATE.prototype.step8 = function(callback){ 212 | var that = this; 213 | this.delay(function(){ 214 | this.tipTop.fadeOut('fast', function(){ 215 | that.tipBot.css({ 216 | background: "url('/assets/animate/p5.png')", 217 | width: '349px', 218 | height: '249px', 219 | position: 'absolute', 220 | left: '348px', 221 | bottom: '115px', 222 | zIndex: '98' 223 | }); 224 | that.info.html(''); 225 | callback.call(that); 226 | }); 227 | }, 2000); 228 | } 229 | 230 | KDANIMATE.prototype.step9 = function(callback){ 231 | var that = this; 232 | this.delay(function(){ 233 | that.tipBot.show().css({ 234 | background: "url('/assets/animate/p6.png')" 235 | }); 236 | setTimeout(function(){ 237 | that.tipBot.css({ 238 | background: "url('/assets/animate/p5.png')" 239 | }); 240 | setTimeout(function(){ 241 | that.tipBot.css({ 242 | background: "url('/assets/animate/p6.png')" 243 | }); 244 | callback.call(that); 245 | }, 500); 246 | }, 500); 247 | }, 500); 248 | } 249 | 250 | KDANIMATE.prototype.step10 = function(callback){ 251 | var that = this; 252 | this.delay(function(){ 253 | that.tipBot.fadeOut('fast', function(){ 254 | that.finger.show().css({ 255 | background: "url('/assets/animate/p7.png')", 256 | width: '627px', 257 | height: '700px', 258 | left: '411px' 259 | }); 260 | callback.call(that); 261 | }); 262 | }, 500); 263 | } 264 | 265 | KDANIMATE.prototype.step11 = function(callback){ 266 | var that = this; 267 | this.delay(function(){ 268 | that.finger.fadeOut('fast', function(){ 269 | that.phoneWindow.css({ 270 | background: "#fff url('/assets/animate/z3.png')" 271 | }); 272 | callback.call(that); 273 | }); 274 | 275 | }, 2000); 276 | } 277 | 278 | KDANIMATE.prototype.step12 = function(callback){ 279 | var that = this; 280 | this.delay(function(){ 281 | this.phoneWindow.css({ 282 | background: "#fff url('/assets/animate/z1.png')" 283 | }); 284 | that.info.html(''); 285 | this.finger.css({ 286 | background: "url('/assets/animate/p3.png')", 287 | width: '419px', 288 | height: '334px', 289 | position: 'absolute', 290 | bottom: '0px', 291 | left: '400px', 292 | zIndex: '99' 293 | }).fadeIn('fast', function(){ 294 | callback.call(that); 295 | }); 296 | }); 297 | } 298 | 299 | KDANIMATE.prototype.step13 = function(callback){ 300 | var that = this; 301 | this.delay(function(){ 302 | this.phoneWindow.css({ 303 | background: "#fff url('/assets/animate/z4.png')" 304 | }); 305 | this.finger.fadeOut('fast', function(){ 306 | callback.call(that); 307 | }); 308 | }, 500); 309 | } 310 | 311 | KDANIMATE.prototype.step14 = function(callback){ 312 | var that = this; 313 | this.delay(function(){ 314 | this.finger.css('left', '300px').fadeIn('fast', function(){ 315 | callback.call(that); 316 | }); 317 | }, 500); 318 | } 319 | 320 | KDANIMATE.prototype.step15 = function(callback){ 321 | var that = this; 322 | this.delay(function(){ 323 | this.phoneWindow.css({ 324 | background: "#fff url('/assets/animate/z3.png')" 325 | }); 326 | this.title.html('一切尽在掌握'); 327 | this.info.html(''); 328 | this.showImage.empty().append(this.ps[7]); 329 | this.showImage.find('img').css('width', '427px').addClass('pull-right'); 330 | this.finger.fadeOut('fast', function(){ 331 | callback.call(that); 332 | }); 333 | }); 334 | } 335 | 336 | KDANIMATE.prototype.step16 = function(callback){ 337 | var that = this; 338 | this.delay(function(){ 339 | this.phoneWindow.css({ 340 | background: "#fff url('/assets/animate/z5.png')" 341 | }); 342 | this.title.html('从此告别零钱'); 343 | this.info.html(''); 344 | this.showImage.empty().append(this.ps[8]); 345 | this.showImage.find('img').css('width', '468px').addClass('pull-right'); 346 | callback.call(that); 347 | }); 348 | } 349 | 350 | KDANIMATE.prototype.step17 = function(callback){ 351 | var that = this; 352 | this.delay(function(){ 353 | this.phoneWindow.css({ 354 | background: "#fff url('/assets/animate/z6.png')" 355 | }); 356 | this.title.html('玩转积分商城'); 357 | this.info.html(''); 358 | this.showImage.empty().append(this.ps[9]); 359 | this.showImage.find('img').css('width', '648px').css({ 360 | position: 'absolute', 361 | bottom: '0px', 362 | right: '0px' 363 | }); 364 | this.info.css('height', '0px'); 365 | callback.call(that); 366 | }); 367 | } 368 | 369 | KDANIMATE.prototype.install = function(){ 370 | var that = this; 371 | this.loadImages('p', 0, function(){ 372 | that.loadImages('z', 0, function(){ 373 | //that.installBox(); 374 | that.play(); 375 | }); 376 | }); 377 | }; 378 | 379 | new KDANIMATE(); 380 | })(jQuery); -------------------------------------------------------------------------------- /snippets/non-alphanumeric.js: -------------------------------------------------------------------------------- 1 | // Source 2 | alert(1) 3 | 4 | // JSFucked 5 | [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[ 6 | ]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[] 7 | ])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+ 8 | (!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+ 9 | !+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![ 10 | ]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![] 11 | +[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[ 12 | +!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!! 13 | []+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![ 14 | ]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[ 15 | ]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![ 16 | ]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(! 17 | []+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[]) 18 | [+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+[+!+[]]+( 19 | !![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[ 20 | ])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])() 21 | -------------------------------------------------------------------------------- /snippets/pointless-if-statement.js: -------------------------------------------------------------------------------- 1 | // Eew 2 | return kRegex.test(value); 3 | 4 | // Beautified 5 | if (kRegex.test(value)) { 6 | return true; 7 | } else { 8 | return false; 9 | } 10 | -------------------------------------------------------------------------------- /snippets/shittify.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var 💩 = "this"; 3 | var 💩💩 = "code"; 4 | var 💩💩💩 = "is a pile"; 5 | var 💩💩💩💩 = "of shit"; 6 | return 💩+💩💩+💩💩💩+💩💩💩💩; 7 | })() 8 | -------------------------------------------------------------------------------- /snippets/zhuangbility.js: -------------------------------------------------------------------------------- 1 | // Boolean 2 | !!'fuck' 3 | 4 | // ParseInt 5 | ~~3.14159 === parseInt(3.14159) 6 | 7 | // Hex 8 | (~~(Math.random()*((1<<24)-1))).toString(16)+'00000').substring(0,7) 9 | 10 | // << 11 | parseInt('1000000000000000000000000', 2) === (1 << 24) 12 | Math.pow(2,24) === (1 << 24) 13 | --------------------------------------------------------------------------------