var u = "Browser";
        if (this.isIPad) {
            u = "iPad"
        } else {
            if (this.isDDGIgnore) {
                u = "Ignore"
            } else {
                if (/seamonkey/.test(x)) {
                    u = "SeaMonkey"
                } else {
                    if (/iceape/.test(x)) {
                        u = "Iceape"
                    } else {
                        if (/palemoon/.test(x)) {
                            u = "PaleMoon"
                        } else {
                            if (this.isFirefox) {
                                u = "Firefox"
                            } else {
                                if (this.isAndroid) {
                                    u = "Android"
                                } else {
                                    if (/xbox/.test(x)) {
                                        u = "xBox"
                                    } else {
                                        if (/midori/.test(x)) {
                                            u = "Midori"
                                        } else {
                                            if (/opr/.test(x)) {
                                                u = "Opera"
                                            } else {
                                                if (/maxthon/.test(x)) {
                                                    u = "Maxthon"
                                                } else {
                                                    if (this.isYandex) {
                                                        u = "Yandex"
                                                    } else {
                                                        if (/vivaldi/.test(x)) {
                                                            u = "Vivaldi"
                                                        } else {
                                                            if (this.isChrome) {
                                                                u = "Chrome"
                                                            } else {
                                                                if (/fennec/.test(x)) {
                                                                    u = "Fennec"
                                                                } else {
                                                                    if (/epiphany/.test(x)) {
                                                                        u = "Epiphany"
                                                                    } else {
                                                                        if (this.isFirefox) {
                                                                            u = "Firefox"
                                                                        } else {
                                                                            if (/uzbl/.test(x)) {
                                                                                u = "Uzbl"
                                                                            } else {
                                                                                if (this.isEdge) {
                                                                                    u = "Edge"
                                                                                } else {
                                                                                    if (this.isIE && navigator.platform === "Win64" && !k() && Modernizr.touch && document.documentElement.clientWidth == screen.width) {
                                                                                        u = "IEMetro"
                                                                                    } else {
                                                                                        if (this.isIE) {
                                                                                            u = "IE"
                                                                                        } else {
                                                                                            if (this.isOpera) {
                                                                                                u = "Opera"
                                                                                            } else {
                                                                                                if (this.isIPhone) {
                                                                                                    u = "iPhone"
                                                                                                } else {
                                                                                                    if (/arora/.test(x)) {
                                                                                                        u = "Arora"
                                                                                                    } else {
                                                                                                        if (this.isSafari) {
                                                                                                            u = "Safari"
                                                                                                        } else {
                                                                                                            if (this.isKonqueror) {
                                                                                                                u = "Konqueror"
                                                                                                            } else {
                                                                                                                if (this.isBlackberry) {
                                                                                                                    u = "Blackberry"
                                                                                                                } else {
                                                                                                                    if (/phantomjs/.test(x)) {
                                                                                                                        u = "PhantomJS"
                                                                                                                    } else {
                                                                                                                        if (this.isIDevice) {
                                                                                                                            u = "iOS"
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

Found when looking at facebook.com code and formatting using google chrome developer tools.

By jcubic, 2017-01-03 18:38:30
var show = true;

function toggleShow(){
    if(show === true){
        show = false;
        return show;
    }else{
        show = true;
        return show;
    }
}

return show = !show, dude...

By Anonymous, 2017-07-14 09:50:57
function focused(evt, errors) {
	let form = evt.target

	const output = errors.map((error)=> {

		// Find first component with error on form and set focus to it

		let focusedInput = (Object.keys(error) == "phonebookId") ? Object.keys(error) :
			(Object.keys(error) == "phonebook_str") ? Object.keys(error) :
				(Object.keys(error) == "message") ? Object.keys(error) :
					(Object.keys(error) == "image") ? Object.keys(error) :
						(Object.keys(error) == "buttonLink") ? Object.keys(error) :
							(Object.keys(error) == "messageSms") ? Object.keys(error) : false
		return focusedInput.shift()
	})

	const selector = output.shift()
	form.querySelector('[id="' + selector + '"]').focus()

	return selector
}

What can I say... If you plan to work with freelancers with low rate then you should be ready to find it in them code :)

By Ya, 2016-10-02 12:16:46
if(wyraz.charAt(i) <"A" 
        && wyraz.charAt(i) != "-" 
            && wyraz.charAt(i)  != " " 
                && wyraz.charAt(i) != "." 
                    && wyraz.charAt(i) != "&" 
                        && wyraz.charAt(i) != "_" 
                            && wyraz.charAt(i) != "\"" 
                                && wyraz.charAt(i) != "'" 
                
) {                
    if(polska_litera(wyraz.charAt(i) ) == 0 ) 
                return NO; 
}
if(wyraz.charAt(i) >"Z" 
           && wyraz.charAt(i) != "-" 
                && wyraz.charAt(i)  != " " 
                    && wyraz.charAt(i) != "." 
                        && wyraz.charAt(i) != "&" 
                            && wyraz.charAt(i) != "_" 
                                && wyraz.charAt(i) != "\""
                                    && wyraz.charAt(i) != "'"
)

Just PKP :)

By Slacki, 2015-07-20 22:43:47
if (i === 1 || i === 2 || i === 3 || i === 4 || i === 5 || i === 6 || i === 7 || i === 8 || i === 9 || i === 10){
 return true;
}
By foxy, 2017-12-13 23:25:17
// Is this valid?
function validateStockInItems() {
    if (stockInItemsToUpdate.length === 0)
        return true;
    return true;
}

Found in a legacy code base for a stock management system. I will be rewriting said system soon.

By Anonymous, 2017-12-13 09:15:42
var filter = options.dataSource.filter();

if(e.filter) {
   filter = filter && filter.filters.length ? filter.filters.concat(e.filter.filter) : e.filter.filters;
}
else {
   filter = filter && filter.filters.length ? filter.filters.linqRemove({ field: e.field }) : [];
}
options.dataSource.filter(filter);
By Anonymous, 2018-02-09 19:03:07
function uploadimg(file) {
    var ext = file.value.split('.').pop().toLowerCase();
    var size = document.getElementById("uploadpic").files.item(0).size;

    if (size > 3145728) {
        $.messager.alert({
            title: "Error",
            msg: " image to large",
            icon: "error"
        });
        return true;
    }

    return false;
}

var reader = new FileReader();
$("#uploadpic").change(function() {
    var pdfcheck = this;
    var ext = pdfcheck.value.split('.').pop().toLowerCase();
    if (!($.inArray(ext, ['pdf']) == -1)) {
        console.log('upload pdf start');
        if (uploadPdf(pdfcheck)) {
            $("#preview_img").attr("src", "");
            $("#preview_img2").attr("src", "");
            $("#uploadpic").prop("file", "");
            $("#uploadpic").val("");
        }
    } else {
        if (uploadimg(pdfcheck)) {//dude, I think the image you upload to check is your dick, only small enough you would rather keep going producing shitcode.
            return false;
        }
        var upload_file = $("#uploadpic")[0].files[0];
        if (upload_file != null) {
            var chimgarr = ["image/png", "image/PNG", "image/jpg", "image/JPG", "image/jpeg", "image/JPEG", "image/gif", "image/GIF", "image/bmp", "image/BMP"];
            if (chimgarr.indexOf(upload_file.type) != "-1") {
                reader.readAsDataURL(upload_file);
                reader.onload = function(e) {
                    $("#preview_img").attr("src", e.target.result);
                    $("#preview_img2").attr("src", e.target.result);
                    $("#pdf-contents").hide();
                    $("#pdf_name").val("");
                    $("#btn_pdf_view").hide();
                    $("#pic_name").val("");
                }
            } else {
                $.messager.alert("Image format does not match");
                $("#preview_img").attr("src", "");
                $("#preview_img2").attr("src", "");
                $("#uploadpic").prop("file", "");
                $("#uploadpic").val("");
            }
        } else {
            $("#preview_img").attr("src", "");
            $("#preview_img2").attr("src", "");
        }
    }
});

The moment an important image ready to be uploaded It's really important that should be checked again and again.

By shitcode master's friend, 2018-04-20 11:03:15
$scope.$$childHead.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling.$$nextSibling

Was trying to find a very specific text box and as an AngularJS noob, this was the only way I could find it at first. I eventually figured out how to not do this before it ever got committed to production though. :)

By Anonymous, 2017-12-12 16:47:10
$("#search-submit").click(function() {
  $("#search form").submit()
});

type="submit" is too mainstream, jquery is the proper way to do it

By Kadet, 2016-02-13 16:44:10
if (currentDay.day() !== MONDAY) {
    do {
        currentDay = this.$moment(currentDay).subtract(1, 'days');
        days.unshift(currentDay);
    } while (currentDay.day() !== MONDAY);
}
By Anonymous, 2017-10-14 18:44:20
if(date.getFullYear() <= 2017) {
    if(date.getMonth() <= 11) {
        if(date.getDate() <= 26) {
            if(date.getHours() <= 23) {
                if(date.getMinutes() <= 59) {
                    if(date.getSeconds() <= 59) {
                        //Display popup before 2017-11-27
                    }
                }
            }
        }
    }
}

    
By Anonymous, 2017-12-12 14:14:55
if (cookiesBannerHeight !== 0 && isMobile) {
      style = {
        top: cookiesBannerHeight === 0 ? 0 : cookiesBannerHeight
      }
}
By Kubus, 2018-02-28 11:00:11
if (botCount < botCount)
    this.reconnect();
}

My friend wrote this code recently

By Anonymous, 2017-12-13 17:47:25
$options.splice($options.indexOf('option7'), 1);
$options.splice($options.indexOf('option5'), 1);
$options.splice($options.indexOf('option4'), 1);
$options.splice($options.indexOf('option3'), 1);
$options.splice($options.indexOf('option2'), 1);
$options.splice($options.indexOf('option1'), 1);
By A "senior" developer, 2018-02-19 16:49:52