in_array($this->market, ["ru"])

There is an old mysterious legend, which says that those conditions are lightening fast which are using in_array($source, ["target"]) instead of just "==". Is says always that probably you never do code refactoring, and keep all shit alive

By Anonymous, 2018-03-12 14:47:24
if ($this->getTestSku()) {
   ...
} elseif ($this->getTestOffset() >= 0 && $this->getTestLimit() > 0) {
   ...
} else {
   Mage::throwException(sprintf("Invalid parameters for test mode: sku %s or offset %s and limit %s", $this->getTestSku(), $this->getTestOffset(), $this->getTestLimit()));
}
By Anonymous, 2018-03-13 13:56:56
#265 PHP +16
if((strtotime(date("Y-m-d"))-strtotime(date("Y-m-d", filemtime($filename))))/(3600)<=$config->hourDiff) return true; else return false;

please notice the brackets around 3600

By Anonymous, 2018-03-13 21:56:00
#266 Java -28
        //JSONObject input;
        
        String givenName = input.get("propName") != null ? (String)input.get("propName") : null;

WHAT DA FUCK ASSHOLES

By Anonymous, 2018-03-15 15:28:55
if student_id:
    assignments = Assignment.objects.filter(week__in=weeks)

    unenrolled_students = Wave.objects.filter(week__in=weeks).values_list('unenrolled_students', flat=True)

    # Construct responses based on assignment type
    Assignment.build_assignments_for_weeks(responses, assignments, students, unenrolled_students)
    max_num_assessments = Assessment.build_assessments_for_weeks(responses)
    Comment.build_comments_for_weeks(responses, weeks, students, unenrolled_students)

elif wave_id:
    assignments = Assignment.objects.filter(week__in=weeks)

    unenrolled_students = Wave.objects.filter(week__in=weeks).values_list('unenrolled_students', flat=True)

    # Construct responses based on assignment type
    Assignment.build_assignments_for_weeks(responses, assignments, students, unenrolled_students)
    max_num_assessments = Assessment.build_assessments_for_weeks(responses)
    Comment.build_comments_for_weeks(responses, weeks, students, unenrolled_students)

else:
    # can't happen
    pass
By Anonymous, 2018-03-23 12:46:10
return isDisabled == false ? false : true;
By Anonymous, 2018-03-23 22:02:31
string AllPDF = "";
int CountPDF = 0;
AllPDF = txtInput.Text;
string[] AllPDF2 = AllPDF.Split(';');
List<string> PDF = new List<string>();
PDF.AddRange(AllPDF2);
while (PDF.Count != CountPDF)
{
    File.Delete(AllPDF2[0 + CountPDF] + ".pdf");
	CountPDF++;
}

I believe, there are so many easier ways to do that

By Anonymous, 2018-03-27 12:15:10
 private void EnableGPSAutoMatically() {
        GoogleApiClient googleApiClient = null;
        if (googleApiClient == null) {
            oogleApiClient = new GoogleApiClient.Builder(this)
                    .addApi(LocationServices.API).addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this).build();
            /* about 50 lines of code were here ... 
             * all depends on this if statement ... !
             * Actually the whole method depends on this if statement ! */
                    }
                }
            });
        }
}

what if that mysterious power change it to be not null !! It gonna be a holly object and You should not "new" it anymore ?! damn ... :)))

By Anonymous, 2018-03-28 11:31:15
set_locations(locations){
    return new Promise((resolve, reject) => {
        this.locations = locations;
        resolve();
    });
}
By Anonymous, 2018-04-04 14:44:45
public bool IsTrue(bool value) {
    return value.ToString().length() == 4;
}
By Anonymous, 2018-04-04 15:46:36
#274 PHP +51
foreach ($k as $kk) {
    foreach ($kk as $kkk) {
    }
}
By Anonymous, 2018-04-05 14:50:22
request.get_something = (something_id) => {
  return new Promise((resolve, reject) => {
    database.find_all('something', { where: {something_id: something_id, is_deleted:0} }).then(function(res){
      let result = {};
      res = JSON.stringify(res);
      res = JSON.parse(res);
      res.forEach(function(element){
        if(typeof element.is_deleted != "undefined"){
          delete element.is_deleted;
        }
        let key = 'something_' + element.id;
        result[key] = element;
      });
      resolve(result);
    }, reject);
  });
}

I LOVE MY JOB!

By ADyingDeveloper, 2018-04-05 17:24:33
function edit_vehality: locality,
      google_place_id: '1'
    };
    let opts = { 'method': 'put', 'route': '/border/' + border_id, 'status': status, 'account_access_token': saved_values.superadmin.account_access_token, 'params': params };
    request(opts)
      .then(function(res) {
        resolve(res.result);
      }).catch(reject);
  })
}
By a poor soul, 2018-04-11 17:07:13
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
let length str =
    let len = String.length str in
    
    let rec length_helper str curr = 
    if str = "" then 0 else 1 + length_helper (String.sub str 1 (len - curr - 1)) (curr + 1)
    
    in length_helper str 0;;

We use this code internally at Google. JFC.

By Mark, 2018-04-21 21:51:57