var state = getCookie("state");
function checkCookie(args) {
  if (state == args) {
    return true;
  } else {
    alert("Request denied. Invalid auth code provided.");
    return false;
  }
}
const tokenElement = document.getElementsByName("dream");
var loginSrv = checkCookie(getAllUrlParams().state);
document.cookie = `state=${getAllUrlParams().state}; path=/`;
tokenElement.innerText = getAllUrlParams().code;
if (getAllUrlParams().state != loginSrv) {
  alert(`Incorrect auth code provided. The correct code is ${state}`);
}

If they provide the wrong oauth state code, tell the user the correct one!

By Demonitized, 2020-08-31 22:12:37
if (!response ||
    !response.data ||
    !response.data.success ||
    response.data.success == false ) {
        //process stuff
}

Not talking about the '===' warning, here

By Anonymous, 2020-12-02 12:31:00
    self.isOptionsVisible = ko.computed(function() {
        if((self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isNameVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isBeforeAfterImagesVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isTooltipVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isLabelVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload') || (self.type() == 'info')) {
            return true;
        }

        return false;
    }, this);

    self.isClassVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isStyleVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

object orientation overrated. let's check the fields in several places ...

By Dude, 2020-12-16 12:25:17
let foo = {} // object no. 1
let bar = {} // object no. 2

foo > bar // return false
foo < bar // return false, so maybe foo equals bar?
foo == bar // oh well, return false
// but
foo >= bar // return true, 'cause !(foo < bar) == true

return value is expected, but JS is funny

By Anonymous, 2021-03-12 21:08:32
let already_in = True;
while (already_in) {
    let random_index = Math.floor(arr.length * Math.random());
    let already_in = False;
    for (ex of exs) {
        if (ex.id === arr[random_index].id) {
            already_in = True;
        }
    }
}

Yes, this is JavaScript, and yes it didn't work. Found while reviewing some code

By L., 2021-05-17 11:20:12
$(document).on('click', '.edit-item', function(event) {
    let row_id = event.currentTarget.attributes['data-row'].value,
    data = dataIndex[
        dataIndex.findIndex(i => i.id === Number(row_id))
    ];
    $('.modal-body div:nth-child(1) input').attr('value', data.name)
    $('.modal-body div:nth-child(2) input').attr('value', data.category)
    $('.modal-body div:nth-child(3) #basicSelect').val(data.status)
    $('.modal-body div:nth-child(4) input').attr('value', data.price)
    $('.modal-body div:nth-child(5) input').attr('value', data.bju.mass)
    $('.modal-body div:nth-child(6) input').attr('value', data.bju.calories)
    $('.modal-body div:nth-child(7) input').attr('value', data.bju.proteins)
    $('.modal-body div:nth-child(8) input').attr('value', data.bju.fats)
    $('.modal-body div:nth-child(9) input').attr('value', data.bju.carbohydrates)
}
)
By Nik Destrave, 2021-05-30 21:59:31
pageEndReached() {
      if (!this.endOfResults) {
        //load more pages
        this.page++;
        this.getPosts();
      followerCount: null,
      postCount: null,
      measurementKeys: ["a", "b", "c", "d", "e"],
      showDrafts: false,
    };
  },

nani

By sonic, 2021-06-08 22:52:01
if(year%100 === 79 ||
year%100 === 90 ||
year%100 === 1 ||
year%100 === 7 ||
year%100 === 18) {
	if(month === 1) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 2) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
	if(month === 3) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 4) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 5) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 6) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 7) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 8) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 9) { while((day + 5)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 10) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 11) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 12) { while((day + 5)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 79 ||
year2%100 === 90 ||
year2%100 === 1 ||
year2%100 === 7 ||
year2%100 === 18) {
	if(month2 === 1) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 2) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
	if(month2 === 3) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 4) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 5) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 6) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 7) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 8) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 9) { while((day2 + 5)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 10) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 11) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 12) { while((day2 + 5)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 79 ||
year3%100 === 90 ||
year3%100 === 1 ||
year3%100 === 7 ||
year3%100 === 18) {
	if(month3 === 1) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 2) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
	if(month3 === 3) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 4) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 5) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 6) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 7) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 8) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 9) { while((day3 + 5)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 10) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 11) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 12) { while((day3 + 5)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 96) {
	if(month === 1) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 2) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
	if(month === 3) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 4) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 5) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 6) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 7) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 8) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 9) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 10) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 11) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 12) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 96) {
	if(month2 === 1) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 2) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
	if(month2 === 3) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 4) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 5) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 6) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 7) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 8) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 9) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 10) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 11) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 12) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 96) {
	if(month3 === 1) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 2) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
	if(month3 === 3) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 4) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 5) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 6) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 7) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 8) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 9) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 10) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 11) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 12) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 85 ||
year%100 === 91 ||
year%100 === 2 ||
year%100 === 13 ||
year%100 === 19) {
	if(month === 1) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 2) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
	if(month === 3) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 4) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 5) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 6) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 7) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 8) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 9) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 10) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 11) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 12) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 85 ||
year2%100 === 91 ||
year2%100 === 2 ||
year2%100 === 13 ||
year2%100 === 19) {
	if(month2 === 1) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 2) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
	if(month2 === 3) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 4) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 5) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 6) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 7) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 8) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 9) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 10) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 11) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 12) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 85 ||
year3%100 === 91 ||
year3%100 === 2 ||
year3%100 === 13 ||
year3%100 === 19) {
	if(month3 === 1) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 2) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
	if(month3 === 3) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 4) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 5) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 6) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 7) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 8) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 9) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 10) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 11) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 12) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 80 ||
year%100 === 8) {
	if(month === 1) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 2) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
	if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 4) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 5) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 6) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 7) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 8) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 9) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 10) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 11) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 12) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 80 ||
year2%100 === 8) {
	if(month2 === 1) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 2) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
	if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 4) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 5) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 6) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 7) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 8) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 9) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 10) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 11) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 12) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 80 ||
year3%100 === 8) {
	if(month3 === 1) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 2) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
	if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 4) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 5) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 6) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 7) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 8) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 9) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 10) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 11) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 12) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 86 ||
year%100 === 97 ||
year%100 === 3 ||
year%100 === 14) {
	if(month === 1) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 2) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
	if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 4) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 5) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 6) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 7) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 8) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 9) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 10) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 11) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 12) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 92) {
	if(month === 1) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 2) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
	if(month === 3) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 4) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 5) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 6) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 7) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 8) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 9) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 10) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 11) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 12) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 86 ||
year2%100 === 97 ||
year2%100 === 3 ||
year2%100 === 14) {
	if(month2 === 1) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 2) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
	if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 4) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 5) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 6) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 7) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 8) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 9) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 10) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 11) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 12) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 92) {
	if(month2 === 1) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 2) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
	if(month2 === 3) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 4) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 5) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 6) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 7) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 8) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 9) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 10) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 11) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 12) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 86 ||
year3%100 === 97 ||
year3%100 === 3 ||
year3%100 === 14) {
	if(month3 === 1) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 2) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
	if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 4) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 5) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 6) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 7) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 8) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 9) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 10) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 11) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 12) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 92) {
	if(month3 === 1) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 2) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
	if(month3 === 3) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 4) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 5) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 6) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 7) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 8) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 9) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 10) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 11) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 12) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 81 ||
year%100 === 87 ||
year%100 === 98 ||
year%100 === 9 ||
year%100 === 17) {
	if(month === 1) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 2) { while(day%7 ===0) {day=Math.ceil(Math.random() * 28);}}
	if(month === 3) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 4) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 5) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 6) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 7) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 8) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 9) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 10) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 11) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 12) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 4) {
	if(month === 1) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 2) { while(day%7 ===0) {day=Math.ceil(Math.random() * 29);}}
	if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 4) { while((day - 5)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 5) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 6) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 7) { while((day - 5)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 8) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 9) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 10) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
	if(month === 11) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
	if(month === 12) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 81 ||
year2%100 === 87 ||
year2%100 === 98 ||
year2%100 === 9 ||
year2%100 === 17) {
	if(month2 === 1) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 2) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
	if(month2 === 3) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 4) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 5) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 6) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 7) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 8) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 9) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 10) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 11) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 12) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 4) {
	if(month2 === 1) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 2) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
	if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 4) { while((day2 - 5)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 5) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 6) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 7) { while((day2 - 5)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 8) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 9) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 10) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
	if(month2 === 11) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
	if(month2 === 12) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 81 ||
year3%100 === 87 ||
year3%100 === 98 ||
year3%100 === 9 ||
year3%100 === 17) {
	if(month3 === 1) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 2) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
	if(month3 === 3) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 4) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 5) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 6) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 7) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 8) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 9) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 10) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 11) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 12) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 4) {
	if(month3 === 1) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 2) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
	if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 4) { while((day3 - 5)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 5) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 6) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 7) { while((day3 - 5)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 8) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 9) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 10) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
	if(month3 === 11) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
	if(month3 === 12) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
By Anonymous, 2021-06-22 15:46:00

class Timer extends React.Component{
    state ={
        time: 10
    };
    setInvt = () =>{
        let t = this.state.time
        if(t<=1){
            clearInterval(this.invertal)
        }
        this.setState({time: t-1})
    }
    componentDidMount(){
        this.invertal = setInterval(this.setInvt, 1000)
    }

    render(){
        return (<label>{this.state.time}</label>)
    }
}

export {Timer}
By Anonymous, 2021-07-30 21:13:46
for (const order of orders) {
    for (const resultItem of results) {
        if (resultItem.machine != "TRANSFER") {
            shiftsLoop: for (const shift of resultItem.shifts) {
                if (shift.products) {
                    for (const product of shift.products) {
                        if (product.product == order.product) {
                            for (const routing of routings) {
                                if (routing.output == order.product) {
                                    const machinePlant = findMachinePlant(resultItem.machine, machines)
                                    if (routing.type == "ODP") {
                                        if (machinePlant == order.plant) {
                                            const msg = createMessage(order, shift, resultItem.machine, CHOR)
                                            requests.push(buildRequest(msg))
                                        } else {
                                            //CHEE CHIE CHEI
                                        }
                                        break shiftsLoop
                                    } else if (routing.type == "OCL" || routing.type == "RCL") {
                                        const msg = createMessage(order, shift, resultItem.machine, CHCL)
                                        requests.push(buildRequest(msg))
                                        //CHCL
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
By sgaloppo, 2021-08-28 20:28:59
'use strict'

// exports //

module.exports = Math.sqrt
By Igor, 2021-09-01 21:28:26
const handleBoolean = value => {
        switch (value) {
            case "true":
                return true;
            case true:
                return "true";
            case "false":
                return false;
            case false:
                return "false"
            default:
                return null;
        }
    }
By Anonymous, 2021-09-29 11:53:22
isCreatedUser : !this.isEdit ? true : false

Vue.js project, someone wanted to verify if the user was being edited or created...

By rat, 2021-10-21 17:11:54
function add(input1,input2) {
	var number1 = input1.toString();
	var number2 = input2.toString();
	var numbers1 = new Array();
	var numbers2 = new Array();
	var size1 = 0;
	var size2 = 0;
	while(size1 < number1.length) {
		var SizeAndNumberToAddToNumbers1Array = 0;
		var Number1FromFunctionAddLength = number1.length-size1-1;
		SizeAndNumberToAddToNumbers1Array = number1.charAt(size1);
		while(Number1FromFunctionAddLength > 0){
			SizeAndNumberToAddToNumbers1Array = SizeAndNumberToAddToNumbers1Array + "0";
			Number1FromFunctionAddLength = Number1FromFunctionAddLength-1;
		}
		numbers1.push(SizeAndNumberToAddToNumbers1Array);
		size1 = size1 + 1;
	}
	while(size2 < number2.length) {
		var SizeAndNumberToAddToNumbers1Array2 = 0;
		var Number1FromFunctionAddLength2 = number2.length-size2-1;
		SizeAndNumberToAddToNumbers1Array2 = number2.charAt(size2);
		while(Number1FromFunctionAddLength2 > 0){
			SizeAndNumberToAddToNumbers1Array2 = SizeAndNumberToAddToNumbers1Array2 + "0";
			Number1FromFunctionAddLength2 = Number1FromFunctionAddLength2-1;
		}
		numbers2.push(SizeAndNumberToAddToNumbers1Array2);
		size2 = size2 + 1;
	}
	var result1 = 0;
	var saize1 = 0;
	while(saize1 < numbers1.length){
		var topush1 = numbers1[saize1];
		result1=result1+parseInt(topush1);
		saize1 = saize1 + 1;
	}
	var result2 = 0;
	var saize2 = 0;
	while(saize2 < numbers2.length){
		var topush2 = numbers2[saize2];
		result2=result2+parseInt(topush2);
		saize2 = saize2 + 1;
	}
	return result1+result2;
}

advanced and optimized add function better than a + b

By Rzaba Kiddo, 2021-11-27 21:25:24
let arr = []
if(arr[record.id]) {
    arr[record.id] = false
} else {
    arr[record.id] = false
}
this.setState({a: arr})
arr = []
By Anonymous, 2021-12-27 06:55:59