├── 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('