/** * lowercase letters */
        $this->store['upper_Spec'] = array( *cut* );
        /** * uppercase letters */
        $this->store['lower_Spec'] = array( *cut* );
      
                    } else {
                      $errmsg='An unknown error occured.';
                    }
                  } else {
                    $errmsg='The passwords you entered do not match';
                  }
                } else {
                  $errmsg='Password has to be at least 8 characters long.';
                }
              } else {
                $errmsg='The email you entered is already in our database.';
              }
            } else {
              $errmsg='Please enter your email address.';
            }
          } else {
            $errmsg='Please enter your first name and your last name.';
          }
        } else {
        (...)
      
        // Happy debugging, suckers
        # define true (rand() > 10)
      

anonymous

0

-- there has to be a smarter way to do this
    | x < 1000000000000 = 
        illion x 1000000000 "billion "
    | x < 1000000000000000 = 
        illion x 1000000000000 "trillion "
    | x < 1000000000000000000 = 
        illion x 1000000000000000 "quadrillion "
    | x < 1000000000000000000000 = 
        illion x 1000000000000000000 "quintillion "
    | x < 1000000000000000000000000 = 
        illion x 1000000000000000000000 "sextillion "
 

anonymous

0

// drunk, fix later
 

anonymous

0

private String isValid(String s) {
  if (...) {
    return Boolean.FALSE.toString();
  } else {
    return Boolean.TRUE.toString();
  }
}

// Later, the only call to isValid:
if (isValid(param).equalsIgnoreCase("TRUE")) {
  ...
}
 

anonymous

0

$id = (int)$id;
if ( !is_int($id) ) {
	return false;
}
 

anonymous

0

array = new array[1024] //that should be enough
 

anonymous

0

Seen in Production code, but not used!

/* encrypt a message with rot13 algorithm */
char *rot13(char *src)
{
  return(src);
}
 

anonymous

0

//I have no shame in submitting my own code
//I have learned my lesson I swear

//It goes on like this for ~11 more lines
var score = scoreList.SelectedIndex;
                switch (score)
                {
                    case (0):
                        sr.WriteLine("score=0");
                        break;
 

anonymous

0

# The following function prototype should be taken out and shot.
ccinfogen :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> ChannelCosterInfo
ccinfogen bi bc bb bf bd bin li lc lb lf ld lin oi oc ob xof od oin osl pbi pbc pbb pbf pbd pbin pli plc plb plf pld plin poi poc pob pof pod poin posl eot eop cin = ChannelCosterInfo btfun lifun lofun eofun cin
     where 
           btfun False s 
            | s == "Int"     = bi
            | s == "Char"    = bc
            | s == "Bool"    = bb
            | s == "Float"   = bf
            | s == "Double"  = bd
            | s == "Integer" = bin
            | otherwise      = error ("Btfun-False of nonbasic type " ++ s)
 

anonymous

0

.margin-top-80px {
  margin-top: 80px;
}
.margin-top-40px {
  margin-top: 40px;
}
.margin-top-30px {
  margin-top: 30px;
}
 

anonymous

0

$(window).load(function () {
    if ('False'.toLowerCase() !== true) {
        //event handlers
    }
}
 

anonymous

0

// skip parameter validation. I know what I'm doing. usually. probably. at least sometimes.
 

anonymous

0

Shared Function isPositiv(ByVal str As String) As Boolean

        Dim test As Boolean = False
        Dim nTest As Decimal

        If str = String.Empty Then
            test = False
        ElseIf str = "0" Then
            test = False
        ElseIf str = "0,0" Then
            test = False
        ElseIf str = "0,00" Then
            test = False
        Else
            If IsNumeric(str) Then
                nTest = CDec(str)
                If nTest > 0 Then
                    test = True
                End If
            End If
        End If

        Return test

    End Function
 

0

if (RUNNING_ENVIRONMENT === 'development') {
    define('CACHE_JS', false);
} else {
    define('CACHE_JS', false);
}
 

anonymous

0

void setformat(int textcolor, int textbackground, int format) {
std::string params;
switch (format) {
case 0:
params="0;";
break;
case 1:
params="1;";
break;
case 2:
params="2;";
break;
case 3:
params="1;2;";
break;
case 4:
params="4;";
break;
case 5:
params="1;4;";
break;
case 6:
params="2;4;";
break;
case 7:
params="1;2;4;";
break;
case 8:
params="5;";
break;
case 9:
params="1;5;";
break;
case 10:
params="2;5;";
break;
case 11:
params="1;2;5;";
break;
case 12:
params="4;5;";
break;
case 13:
params="1;4;5;";
break;
case 14:
params="2;4;5;";
break;
case 15:
params="1;2;4;5;";
break;
case 16:
params="9;";
break;
case 17:
params="1;9;";
break;
case 18:
params="2;9;";
break;
case 19:
params="1;2;9;";
break;
case 20:
params="4;9;";
break;
case 21:
params="1;4;9;";
break;
case 22:
params="2;4;9;";
break;
case 23:
params="1;2;4;9;";
break;
case 24:
params="5;9;";
break;
case 25:
params="1;5;9;";
break;
case 26:
params="2;5;9;";
break;
case 27:
params="1;2;5;9;";
break;
case 28:
params="4;5;9;";
break;
case 29:
params="1;4;5;9;";
break;
case 30:
params="2;4;5;9;";
break;
case 31:
params="1;2;4;5;9;";
break;
}
cout << "\033[" << params << 30+textcolor << ";" << 40+textbackground << "m";
}
 

anonymous

+2

// if the computer is fast, set this to true, else set this to false
#define FAST true
// ...
if (FAST) {
// sleep a long while
for (long l=0; l<10000000000000000L; l=l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+1);
} else {
// sleep a long while
for (long l=0; l<1000000000000L; l=l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+l-l+1);
}
 

anonymous

0

// NOT WORKING: for some reason result appears reversed, if somebody knows a way to fix it, I would appreciate it

int one = 1;
int two = 2;
int three = 3;
int four = 4;
int five = 5;
int six = 6;
int seven = 7;
int eight = 8;
int nine = 9;
int zero = 0;

while (result2>0) {
	switch (result2%10) {
		case 0:
			printf("%d",zero);
			break;
		case 1:
			printf("%d",one);
			break;
		case 2:
			printf("%d",two);
			break;
		case 3:
			printf("%d",three);
			break;
		case 4:
			printf("%d",four);
			break;
		case 5:
			printf("%d",five);
			break;
		case 6:
			printf("%d",six);
			break;
		case 7:
			printf("%d",seven);
			break;
		case 8:
			printf("%d",eight);
			break;
		case 9:
			printf("%d",nine);
			break;
		default:
			printf("%d",result2 % 10);
			break;
	}
	result2 = result2 / 10;
}
 

anonymous

0

void some_NP_complete_problem_impl (int** arg1, int arg2, int arg3) {
// I found an awesome implementation of this problem in polynomial time,
// but I think it's rude to waste the work of my colleague, so I'll leave it as it is.
[...]
}
 

anonymous

+3

var number = 10.632222232;

function round2Decimal(number) {
    return parseFloat(number.toString().substr(0, number.toString().indexOf('.') + 2) + (number.toString()[number.toString().indexOf('.') + 3] >= 5 ? (parseInt(number.toString()[number.toString().indexOf('.') + 2]) + 1).toString() : number.toString()[number.toString().indexOf('.') + 2]));
}

var roundedNumber = round2Decimal(number);
 

anonymous

+2

var arr = "5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,8,8,8,8,8,8,8,5,10,8,8,8,8,10,10,8,12,10,10,8,10,10,8,8,8,10,10,10,8,10,10,8,10,5,".split(',');
 

anonymous

0

int shift(int x, int y)
{
     int r = x;
     for(int i = 0; i < y; ++i)
     {
         r = r << 1;
     }
     return r;
}
 

anonymous

+3

#actual infinite loop from production code:

while True is not False and True or False is False or False and True is not False and True:
  socket.listen()
 

anonymous

+1

//TODO: hash it
byte[] password = System.Text.Encoding.UTF8.GetBytes( pwd.ToString() );
Array.Reverse(password);
string tmpPassword = Convert.ToBase64String( password );
 

anonymous

+1

if(  $username == "admin" &&
     sha1(SALT . $password) == "2e7ee9a0c8c420711c709d908c37ee65f41276fd") { //check if password is "m8onIBBpRU"
     $adminSessionController->loggedIn(true);
}
 

anonymous

0

/// <summary>
///     Gets a value indicating whether is valid employee id.
 /// </summary>
public bool IsValidEmployeeId
{
     get
     {
          return this.EmployeeId.Length > 0  || this.EmployeeId.Length < 33;
     }
}
 

anonymous

+1

img{
font-weight:bold;
}
 

+2

    public static int igenyszintToSzint(int igeny)
    {
        switch(igeny)
        {
            case 1: return 1;
            case 2: return 2;
            case 3: return 3;
            case 4: return 4;
            default : return 0;
        }
    }
    
    public static int szintToIgenySzint(int szint)
    {
        switch(szint)
        {
            case 1: return 1;
            case 2: return 2;
            case 3: return 3;
            case 4: return 4;
            default: return 0;
        }
    }
 

anonymous

+1

// I recently joined the software developers of an FRC robotics team, and found stuff like this:
public static void print(int line, int column, String message, Object... parms) {
	String lcdLine = "";

	switch(line) {
		case 1:
			lcdLine = "LCD_Line_1";
			break;
		case 2:
			lcdLine = "LCD_Line_2";
			break;
		case 3:
			lcdLine = "LCD_Line_3";
			break;
		case 4:
			lcdLine = "LCD_Line_4";
			break;
		case 5:
			lcdLine = "LCD_Line_5";
			break;
		case 6:
			lcdLine = "LCD_Line_6";
			break;
		case 7:
			lcdLine = "LCD_Line_7";
			break;
		case 8:
			lcdLine = "LCD_Line_8";
			break;
		case 9:
			lcdLine = "LCD_Line_9";
			break;
		case 10:
			lcdLine = "LCD_Line_10";
			break;
	}
	SmartDashboard.putString(lcdLine, String.format(message, parms));
}

// Yep. This is real code that was on the robot during competitions. I might post more, there's a lot.
 

anonymous

+1

@Test
public void testGetResource() throws Exception {
      
     String basepath = "C:\\Documents and Settings\\<some guy's name>\\Desktop\\testfolder";
     // some other code
}
 

anonymous

+1

// IEventLogGroupConfigurator configurator = new EsEventLogGroupConfigurator();
// TODO: remove above line
 

anonymous

+2

// This is production code. No kidding
'numera zeros a esquerda 7 digitos #################################################################
function retorna_digitos_7(digitos)
	conta_string = Len(digitos)
	if conta_string=1 then
		digitos = "000000"&digitos
	elseif 	conta_string = 2 then
		digitos = "00000"&digitos
	elseif 	conta_string =3 then
		digitos = "0000"&digitos
	elseif 	conta_string =4 then
		digitos = "000"&digitos
	elseif 	conta_string =5 then
		digitos = "00"&digitos
	elseif 	conta_string =6 then
		digitos = "0"&digitos		
	else
		digitos = digitos
	end if
	retorna_digitos_7 = digitos
end function

'numera zeros a esquerda 6 digitos #################################################################
function retorna_digitos_6(digitos)
	conta_string = Len(digitos)
	if conta_string=1 then
		digitos = "00000"&digitos
	elseif 	conta_string = 2 then
		digitos = "0000"&digitos
	elseif 	conta_string =3 then
		digitos = "000"&digitos
	elseif 	conta_string =4 then
		digitos = "00"&digitos
	elseif 	conta_string =5 then
		digitos = "0"&digitos	
	else
		digitos = digitos
	end if
	retorna_digitos_6 = digitos
end function
'numera zeros a esquerda 5 digitos #################################################################
function retorna_digitos_5(digitos)
	conta_string = Len(digitos)
	if conta_string=1 then
		digitos = "0000"&digitos
	elseif 	conta_string = 2 then
		digitos = "000"&digitos
	elseif 	conta_string =3 then
		digitos = "00"&digitos
	elseif 	conta_string =4 then
		digitos = "0"&digitos
	else
		digitos = digitos
	end if
	retorna_digitos_5 = digitos
end function
'numera zeros a esquerda 4 digitos #################################################################
function retorna_digitos_4(digitos)
	conta_string = Len(digitos)
	if conta_string=1 then
		digitos = "000"&digitos
	elseif 	conta_string = 2 then
		digitos = "00"&digitos
	elseif 	conta_string =3 then
		digitos = "0"&digitos
	else
		digitos = digitos
	end if
	retorna_digitos_4 = digitos
end function
'###################################################################################################
function retorna_digitos_3(digitos)
	conta_string = Len(digitos)
	if conta_string=1 then
		digitos = "00"&digitos
	elseif 	conta_string = 2 then
		digitos = "0"&digitos
	else
		digitos = digitos
	end if
	retorna_digitos_3 = digitos
end function

function retorna_digitos_2(digitos)
	conta_string = Len(digitos)
	if conta_string=1 then
		digitos = "0"&digitos
	else
		digitos = digitos
	end if
	retorna_digitos_2 = digitos
end function
'###################################################################################################
 

+5

public class Bank_12
{
 
/*Blah blah... Basically, this was a pathetic attempt to curb copying in one of the "top"
engineering universities. Every student have to suffix every variable, class, method
(identifier) with the his/her registration number so that people don't "rip off code" from
other students. It obviously works because it is SOOOOO hard to do a find+replace with
your own number.
*/
 
    private int balance_12;
    private String name_12;
 
    public Bank_12(String name_12, balance_12)
    {
       this.name_12 = name_12;
       this.balance_12 = balance_12;
    }
 
    public void getBalance_12()
    {
        return balance_12;
    }
}
 

anonymous

+5

dataList
    .forEach(function(data, index) {
        switch (index) {
            case 0:
                item1 = data;
                return;
            case 1:
                item2 = data;
                return;
        }
    });
 

anonymous

+5

if ((action == nil) || ((action != nil)) {
    // Stuff...
}
 

anonymous

+2

    Dim oHeaderTextParam
    Set oHeaderTextParam = Nothing
    Set oHeaderTextParam = oParamSet_GN.DirectParameters.Item(sHeaderTextParamName)
    Dim oBodyTextParam
    Set oBodyTextParam = Nothing
    Set oBodyTextParam = oParamSet_GN.DirectParameters.Item(sBodyTextParamName)
    Dim oFooterTextParam
    Set oFooterTextParam = Nothing
    Set oFooterTextParam = oParamSet_GN.DirectParameters.Item(sFooterTextParamName)
    Dim oVersionParam
    Set oVersionParam = Nothing
    Set oVersionParam = oParamSet_GN.DirectParameters.Item(sGN_VersionParamName)
    Dim oUpdateParam
    Set oUpdateParam = Nothing
    Set oUpdateParam = oParamSet_GN.DirectParameters.Item(sGN_UpdateParamName)
    Dim oConfigParam
    Set oConfigParam = Nothing
    Set oConfigParam = oParamSet_GN.DirectParameters.Item(sGN_ConfigParamName)
 

anonymous

+1

 //Make sure we don't trigger this condition while in prod. Note to self, remove the (1 == 2) before release
if ($_SERVER['HTTP_USER_AGENT'] != "Valve/Steam HTTP Client 1.0" && 1 == 2) {            
    //some code that basically redirect to an access denied page
}
 

anonymous

+1

<?php
$arr_a = array("A" => 1,"B"=> 2,"C"=> 3,"D"=> 4,"E"=> 5);
$arr_b = $arr_a;
$arr_c = $arr_a;
$arr_d = $arr_a;
$arr_e = $arr_a;
$combos = 0;

echo "\n";
foreach($arr_a as $key_a => $number_a) {
    foreach($arr_b as $key_b => $number_b) {
        foreach($arr_c as $key_c => $number_c) {
            foreach($arr_d as $key_d => $number_d) {
                foreach($arr_e as $key_e => $number_e) {
                    echo $key_a.$key_b.$key_c.$key_d.$key_e." ".($number_a+$number_b+$number_c+$number_d+$number_e)."\n";
                    $combos++;
                }
            }
        }
    }
}
echo $combos."\n";
 

0

/**
 * Get some property
 * @throws NullPointerException Throws if contact is null    <<-- No kidding?
 */
public boolean getSomeProperty(Contact contact, String name, boolean defaultValue) throws NullPointerException {
  if(contact == null) {
    throw new NullPointerException();                <<-- Oh, what a relief
  }
  return getSomeBooleanProperty(contact, defaultValue);
}
 

anonymous

+1

// This if from actual commercial quite serious project
// So, for how long does this thread sleep?
final int wait100Ms = 300;
for( int i=0; i < wait100Ms; i++) {
  try {
    Thread.sleep(100);
  } catch (InterruptedException e) {
  }
}
 

anonymous

+1

// ----------------------------------------------------------------
// People were reporting random PHP errors on the loading screen
// and I don't feel like maintaining the code of another person. 
// So yeah, fuck it. 
     error_reporting(0);
//
// THERE I FIXED IT 
// ----------------------------------------------------------------
 

+2

svg .white {
    fill: $grey;
}