int min(int a,int b,int c) //Function to return the minimum.
{
if(a < b)
{
if(a < c)return a;
else if(a > c)return c;
else return a;
}
else if(a > b)
{
if(b < c)return b;
else if(b > c)return c;
else return b;
}
else
{
if(a < c) return a;
else if(a > c) return c;
else return a;
}
}
This kind of things make me hate my work.
guard let reachability = Reachability(), reachability.isReachable == true else {
// No network connection available. Do stuff.
...
}
While this works, it's not immediately readable and creates confusion. Mis-using Swift's control flow. Did not pass code review.
function isAllowSearchLength(text) {
return text.length > isNaN(parseInt(text, 10)) ? 1 : 0;
}
private static int alphabetToNumber(String letter) {
String s = letter.toLowerCase();
if (s.equals("a")) {
return 1;
} else if (s.equals("b")) {
return 2;
} else if (s.equals("c")) {
return 3;
} else if (s.equals("d")) {
return 4;
} else if (s.equals("e")) {
return 5;
} else if (s.equals("f")) {
return 6;
} else if (s.equals("g")) {
return 7;
} else if (s.equals("h")) {
return 8;
} else if (s.equals("i")) {
return 9;
} else if (s.equals("j")) {
return 10;
} else if (s.equals("k")) {
return 11;
} else if (s.equals("l")) {
return 12;
} else if (s.equals("m")) {
return 13;
} else if (s.equals("n")) {
return 14;
} else if (s.equals("o")) {
return 15;
} else if (s.equals("p")) {
return 16;
} else if (s.equals("q")) {
return 17;
} else if (s.equals("r")) {
return 18;
} else if (s.equals("s")) {
return 19;
} else if (s.equals("t")) {
return 20;
} else if (s.equals("u")) {
return 21;
} else if (s.equals("v")) {
return 22;
} else if (s.equals("w")) {
return 23;
} else if (s.equals("x")) {
return 24;
} else if (s.equals("y")) {
return 25;
} else if (s.equals("z")) {
return 26;
} else {
return 0;
}
}
$_POST = $this->db->mres($_POST);
$_SESSION['post'] = $_POST;
$sql = "SELECT id, documento, nombre1, nombre2, apellido1, apellido2 "
. "FROM usuarios "
. "WHERE " .
"REPLACE(" .
"REPLACE(" .
"REPLACE(" .
"REPLACE(telefono,' ','')," .
"'(','')," .
"')','')," .
"'-','') LIKE '%{$searchTel}'";
date('Y-m-d').'T'.date("H:i:s", strtotime("- 1 hour")).'Z'
Back to the future
this.unwatchBackdrop ? this.unwatchBackdrop() : this.noop();
...
private noop(): void {}
function getJSType(cppType: string) {
let typeMap = new Map<string, string>([
["Bool", "boolean"],
["Int32", "number"],
["UInt32", "number"],
["Int64", "number"],
["UInt64", "number"],
["Double", "number"],
["String", "string"],
["Object", "any"]
]);
if (typeMap.get(cppType) === undefined) {
console.error("Invalid type in getJavascriptType: " + cppType);
process.exit(1);
}
return typeMap.get(cppType);
}
//Говорящие названия - такие говорящие!
function asdfasdf (WebAPI_Entity $screenshot_dictionary)
{
$result = array();
foreach ($screenshot_dictionary->getEntities () as $scr)
{
$result [] = $scr->toObject ();
}
usort($result, array ($this, 'sortScreenshots'));
return $this->prepare_screenshots ($result);
}
// вставляем остальные скриншоты
$elements = $this->asdfasdf ($screenshot_dictionary);
int number = -1;
//todo: refactor this horse shit.
for (String res: results) {
if(number == -1){
if(res.toLowerCase().contains("ten") || res.contains("10") || res.contains("10") || res.contains("十") || res.contains("십")){
number = 10;
}
else if(res.toLowerCase().contains("nine") || res.contains("9") || res.contains("9") || res.contains("九") || res.contains("구")){
number = 9;
}
else if(res.toLowerCase().contains("eight") || res.contains("8") || res.contains("8") || res.contains("八") || res.contains("팔")){
number = 8;
}
else if(res.toLowerCase().contains("seven") || res.contains("7") || res.contains("7") || res.contains("七") || res.contains("칠")){
number = 7;
}
else if(res.toLowerCase().contains("six") || res.contains("6") || res.contains("6") || res.contains("六") || res.contains("육")){
number = 6;
}
else if(res.toLowerCase().contains("five") || res.contains("5") || res.contains("5") || res.contains("五") || res.contains("오")){
number = 5;
}
else if(res.toLowerCase().contains("four") || res.contains("4") || res.contains("4") || res.contains("四") || res.contains("사")){
number = 4;
}
else if(res.toLowerCase().contains("three") || res.contains("3") || res.contains("3") || res.contains("三") || res.contains("삼")){
number = 3;
}
else if(res.toLowerCase().contains("two") || res.contains("2") || res.contains("2") || res.contains("二") || res.contains("이")){
number = 2;
}
else if(res.toLowerCase().contains("one") || res.contains("1") || res.contains("1") || res.contains("一") || res.contains("일")){
number = 1;
}
}
}
refactor this horse shit.
value unless value.select! { |v| v != "0" }.nil?
I don't not know no why not no one of my "predecessor" committed this shit.
if(
(!_.isEmpty($(switcher).val()) && value_isnt == ":empty") ||
((value_isnt) && !$(switcher).is(value_isnt) && value_isnt != ':empty') ||
(value_is && $(switcher).is(value_is) && value_is != ':empty') ||
(value_is == ':empty' && _.isEmpty($(switcher).val())) ||
(value && _switcherValue == value) ||
(valueIn && .anyMatchInArray(valueIn.split(','), .flatten([_switcherValue]))) ||
(valueOut && !.anyMatchInArray(valueOut.split(','), .flatten([_switcherValue])))
)
if (i === 1 || i === 2 || i === 3 || i === 4 || i === 5 || i === 6 || i === 7 || i === 8 || i === 9 || i === 10){
return true;
}
if ( x == true)
{
// do something
}
Fucking amateurs :| lol
public void Handle(SomethingCreatedEvent e)
{
if (e.ActCode == "SOME_VALUE")
{
return;
}
else
{
// insert real function body here
}
}