function atoi(charstring)
{
if(charstring=="a") return 0x61;if(charstring=="b") return 0x62;
if(charstring=="c") return 0x63;if(charstring=="d") return 0x64;
if(charstring=="e") return 0x65;if(charstring=="f") return 0x66;
if(charstring=="g") return 0x67;if(charstring=="h") return 0x68;
if(charstring=="i") return 0x69;if(charstring=="j") return 0x6a;
if(charstring=="k") return 0x6b;if(charstring=="l") return 0x6c;
if(charstring=="m") return 0x6d;if(charstring=="n") return 0x6e;
if(charstring=="o") return 0x6f;if(charstring=="p") return 0x70;
if(charstring=="q") return 0x71;if(charstring=="r") return 0x72;
if(charstring=="s") return 0x73;if(charstring=="t") return 0x74;
if(charstring=="u") return 0x75;if(charstring=="v") return 0x76;
if(charstring=="w") return 0x77;if(charstring=="x") return 0x78;
if(charstring=="y") return 0x79;if(charstring=="z") return 0x7a;
if(charstring=="0") return 0x30;if(charstring=="1") return 0x31;
if(charstring=="2") return 0x32;if(charstring=="3") return 0x33;
if(charstring=="4") return 0x34;if(charstring=="5") return 0x35;
if(charstring=="6") return 0x36;if(charstring=="7") return 0x37;
if(charstring=="8") return 0x38;if(charstring=="9") return 0x39;
if(charstring==".") return 0x2e;
return 0x20;
}
found in a proxy script
$("#search-submit").click(function() {
$("#search form").submit()
});
type="submit"
is too mainstream, jquery is the proper way to do it
function isEmpty(value) {
if (value === '') {
return false;
} else if (value === 0) {
return false;
} else if (value === null) {
return false;
} else if (value === undefined) {
return false;
} else {
return true;
}
return true;
}
javascript empty value check
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
}
}
}
}
}
}
function changePassword() {
if (isInputEmpty()) {
$.ajax({
type: 'POST',
data: '...'
url: '...',
success: function (result) {
if (result.substring(0, 3) != "!!!") {
//success
} else {
//faliure
}
},
error: function () {
}
});
}
}
And of course,in production, it always reported success and never changed the password, because of equally bad server code.
let arr = []
if(arr[record.id]) {
arr[record.id] = false
} else {
arr[record.id] = false
}
this.setState({a: arr})
arr = []
var i = 0
for (var n in array) {
i+=1
// ...
}
else if result !== true && result === false { return result !== true }
should I keep this in our project or nah
var lightBox_ReplaceSelectsWithSpans = function()
{
var selects = document.getElementsByTagName('select');
for (var i = 0; i < selects.length; i++) {
var select = selects[i];
if (select.clientWidth == 0 || select.clientHeight == 0 ||
select.nextSibling == null || select.nextSibling.className == 'selectReplacement') {
continue;
}
var span = document.createElement('span');
// this would be "- 3", but for that appears to shift the block that contains the span
// one pixel down; instead we tolerate the span being 1px shorter than the select
span.style.height = (select.clientHeight - 4) + 'px';
span.style.width = (select.clientWidth - 6) + 'px';
span.style.display = 'inline-block';
span.style.border = '1px solid rgb(200, 210, 230)';
span.style.padding = '1px 0 0 4px';
span.style.fontFamily = 'Arial';
span.style.fontSize = 'smaller';
span.style.position = 'relative';
span.style.top = '1px';
span.className = 'selectReplacement';
span.innerHTML = select.options[select.selectedIndex].innerHTML ;//+
//'<img src="custom_drop.gif" alt="drop down" style="position: absolute; right: 1px; top: 1px;" />';
select.cachedDisplay = select.style.display;
select.style.display = 'none';
select.parentNode.insertBefore(span, select.nextSibling);
}
};
public void updateCurrency() {
LOGGER.info("Update currencies");
var ok = false;
try {
getExchangeRatesMechanism(getExchangeRatesProcessor());
ok = true;
} catch (Exception exception) {
LOGGER.error(exception.getMessage(), exception);
}
if (ok) {
LOGGER.info("The currencies were updated successfully!");
}
}
> var x = 3;
> '5' + x - x
50
> '5' - x + x
5 // Because fuck math
JS is simply. Oh, wait...
function urlREPLACER(dtTEXTVALUE){
dtTEXTVALUE.indexOf('http://') != -1 && (dtTEXTVALUE = dtTEXTVALUE.replace('http://','')) && dtTEXTVALUE.indexOf('.aspx') == -1 && (dtTEXTVALUE += '.aspx');
return dtTEXTVALUE;
}
$('#userCheck').not(this).prop('checked', false);
form = JSON.parse(JSON.stringify(this.mobilityDistanceForm.getRawValue()));
if (currentDay.day() !== MONDAY) {
do {
currentDay = this.$moment(currentDay).subtract(1, 'days');
days.unshift(currentDay);
} while (currentDay.day() !== MONDAY);
}