double func_atof(char *p){
	double	 integer = 0.0, div = 1.0 , fract = 0.0 , sign = 1.0;
   if(   *p == 45  ){sign = -1.0, *p++ ; }
	while ( isdigit(*p)  ) { 
		integer = ( *p++ )  +  (10.0   *   integer)  -  48.0 ; 
		}
	if(*p == 46  ){
	(*p++ ) ;
	while (  isdigit(*p) )  {
		fract = ( *p++ )  +  (10.0   *   fract)  -  48.0  ; 
		div *= 10;		
		}
    }
  return    (integer  +   fract  / div )  * sign    ;
}
By Lazy_8, 2020-01-13 16:53:53
Public Shared Function CompeleteDateStr(DateStr As String) As String
    'MBS 96-09-25: High Caliber DataEntry
    Dim DateVal = CType(DateStr, Integer)
    If DateVal < 1 Then Return ""
    If DateVal < maxDay Then 'DayOnly
        Return MakeJalaliDate(curYear, curMonth, DateVal, _4DigitYear)
    ElseIf DateVal > maxDay Then
        Dim YearPiece? As Short = Nothing, MonthPiece? As Byte = Nothing, DayPiece As Byte
        Select Case DateVal
            Case Is < 100
                MonthPiece = (DateVal \ 10) Mod 10
                DayPiece = DateVal Mod 10
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
            Case Is < 1000
                MonthPiece = DateVal \ 10
                DayPiece = DateVal Mod 10
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                MonthPiece = (DateVal \ 100) Mod 10
                DayPiece = DateVal Mod 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                DayPiece = DateVal \ 10
                MonthPiece = DateVal Mod 10
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                DayPiece = (DateVal \ 100) Mod 10
                MonthPiece = DateVal Mod 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
            Case Is < 10000
                MonthPiece = DateVal \ 100
                DayPiece = DateVal Mod 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                MonthPiece = DateVal Mod 100
                DayPiece = DateVal \ 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                DayPiece = DateVal \ 100
                MonthPiece = DateVal Mod 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                DayPiece = DateVal Mod 100
                MonthPiece = DateVal \ 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                MonthPiece = (DateVal \ 10) Mod 10
                YearPiece = DateVal \ 100
                If IsValidMonth(MonthPiece) Then
                    DayPiece = DateVal Mod 10
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                Else
                    MonthPiece = (DateVal \ 100) Mod 10
                    YearPiece = DateVal Mod 100
                    DayPiece = DateVal \ 1000
                    If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                End If
            Case Is < 100000
                Dim DaySize As Byte = 2
                MonthPiece = (DateVal Mod 1000) \ 10
                If Not IsValidMonth(MonthPiece) Then
                    MonthPiece = (DateVal \ 100) Mod 10
                    DaySize = 1
                    If Not IsValidMonth(MonthPiece) Then Return ""
                End If
                YearPiece = DateVal \ 1000
                DayPiece = DateVal Mod 10 ^ DaySize
                If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
                YearPiece = DateVal Mod 100
                DayPiece = DateVal \ (10000 \ (10 ^ DaySize))
                If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
            Case Is < 1000000
                MonthPiece = (DateVal Mod 10000) \ 100
                If IsValidMonth(MonthPiece) Then
                    YearPiece = DateVal \ 10000
                    DayPiece = DateVal Mod 100
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                    YearPiece = DateVal Mod 100
                    DayPiece = DateVal \ 10000
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                End If
                YearPiece = DateVal \ 100
                If YearPiece > 1300 AndAlso YearPiece < 1500 Then
                    MonthPiece = (DateVal \ 10) Mod 10
                    DayPiece = DateVal Mod 10
                    If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                End If
                YearPiece = DateVal Mod 10000
                If YearPiece > 1300 AndAlso YearPiece < 1400 Then
                    DayPiece = DateVal \ 100000
                    MonthPiece = (DateVal \ 10000) Mod 10
                    If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece + If(_4DigitYear, 0, -1300), MonthPiece, DayPiece, _4DigitYear)
                End If
            Case Is < 10000000
                Dim DaySize As Byte = 2
                MonthPiece = (DateVal Mod 1000) \ 10
                If Not IsValidMonth(MonthPiece) Then
                    MonthPiece = (DateVal \ 100) Mod 10
                    DaySize = 2
                    If Not IsValidMonth(MonthPiece) Then Return ""
                End If
                YearPiece = DateVal \ 1000
                DayPiece = DateVal Mod 10 ^ DaySize
                If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
                YearPiece = DateVal Mod 10000
                DayPiece = DateVal \ (100000 * (10 ^ DaySize))
                If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
            Case Is < 100000000
                MonthPiece = (DateVal Mod 10000) \ 100 '13961229
                If IsValidMonth(MonthPiece) Then
                    YearPiece = DateVal \ 10000
                    DayPiece = DateVal Mod 100
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                    YearPiece = DateVal Mod 10000
                    DayPiece = DateVal \ 1000000
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                End If
        End Select
        Return ""
    End If
End Function

this code is so wrong in so many different levels

By NoobProger, 2017-12-20 12:37:08
class PythonClass {
    protected boolean True = true;
    protected boolean False = false;
    protected Object None = null;
}

class MyClass extends PythonClass {
    String do_something(Object foo) {
        if (foo == False)
            return ""                                  ;
        
        
        else if (foo == None)
            return "!"                                 ;
            
        else if (foo == True)
            return "Yay!"                              ;
    }
}

Yikes

By imaginedev, 2021-04-03 02:44:52
$("#search-submit").click(function() {
  $("#search form").submit()
});

type="submit" is too mainstream, jquery is the proper way to do it

By Kadet, 2016-02-13 16:44:10
if yearOfBirth > 2002 {
    fmt.Errorf("year of birth not allowed %d", yob)
    return
}
By V, 2021-06-15 14:53:58
"check cassandra config" in {
  val config: Configuration = pureconfig.loadConfigOrThrow[Configuration]
  config.cassandra.hosts shouldBe List("192.168.26.207")
  config.cassandra.keyspace shouldBe "releases"
}

Why not to check works cassandra or not? What is the difference between this and hardcoding data right in source?

By Anonymous, 2019-05-07 18:28:04
int w = 100;

for (nil; w!=0; nil) {

    w -= 1;

    //so some shit
}

this code was found in chinese contract work

By JeanetteMueller, 2021-03-08 11:58:39
if ($customerId > 0) {
    $customerId = $customerId;
} else {
    $customerId = $this->customerSession->getId();
}
By Anonymous, 2018-01-10 16:42:14
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
local part = script.Parent

local OriginColor = Color3.new(0,170,255)

local KillColor = Color3.new(1, 0, 0)

part.Touched:Connect(function(H)
	local humanoid = H.Parent:FindFirstChild("Humanoid")
	if humanoid and part.Color == KillColor then
		humanoid.Health = 0

	end

end)

local shit = 1
repeat

	part.Color = OriginColor
	wait(1.5) 
	part.Color = KillColor
	wait(1.5)



until shit == 2
By petierko, 2021-06-23 19:02:54

var move=0;
var kier=0;
var pic=0;
var rol=0;

var rol2=171;
var rol3=343;
var rol4=514;
var rol2_cel=171;
var rol3_cel=343;
var rol4_cel=514;

function onpic(p) {
  pic=p;
}

function offpic(p) {
  if( pic==p ) pic=0;
}

 function next() { if(move<40) move = 40; kier=0; }
 function prev() { if(move<40) move = 60; kier=1; }
 function set() {
  document.getElementById('ba1').style.left=0;
  document.getElementById('ba2').style.left=rol2;
  document.getElementById('ba3').style.left=rol3;
  document.getElementById('ba4').style.left=rol4;
}


function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}


var randtim=new Array(110,103,130,125,108,118,112,122,101,100);
var showtimer=0;
var showpic=1;

 
 function Animuj() {
   if( pic==0 ) {
     rol2_cel=171;
     rol3_cel=343;
     rol4_cel=514;
   } else if( pic==1 ) {
     rol2_cel=342;
     rol3_cel=457;
     rol4_cel=571;
   } else if( pic==2 ) {
     rol2_cel=115;
     rol3_cel=457;
     rol4_cel=571;
   } else if( pic==3 ) {
     rol2_cel=114;
     rol3_cel=229;
     rol4_cel=571;
   } else if( pic==4 ) {
     rol2_cel=114;
     rol3_cel=228;
     rol4_cel=344;
   }
   var a = (rol2-rol2_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol2!=rol2_cel ) rol2-= a;
   var a = (rol3-rol3_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol3!=rol3_cel ) rol3-= a;
   var a = (rol4-rol4_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol4!=rol4_cel ) rol4-= a;
   set();
    document.getElementById('ba2').style.left=rol2;



 showtimer+=1;
 if(showtimer>100) {
  for( st=0; st<9; ++st ) {
   if(showtimer==randtim[st]) { SetOpacity(document.getElementById("ps"+st), 0); document.getElementById("ps"+st).style.backgroundImage="url('cs/log"+showpic+".jpg')"; }
   if(showtimer==(randtim[st]+1)) SetOpacity(document.getElementById("ps"+st),20); 
   if(showtimer==(randtim[st]+2)) SetOpacity(document.getElementById("ps"+st),40); 
   if(showtimer==(randtim[st]+3)) SetOpacity(document.getElementById("ps"+st),60); 
   if(showtimer==(randtim[st]+4)) SetOpacity(document.getElementById("ps"+st),80); 
   if(showtimer==(randtim[st]+5)) { document.getElementById("pn"+st).style.backgroundImage="url('cs/log"+showpic+".jpg')"; SetOpacity(document.getElementById("ps"+st),0); }
  }
  if(showtimer>150) {
   showtimer=0;
   for( st=0; st<9; ++st ) randtim[st]=Math.floor(Math.random()*26)+100;
   showpic+=1; if(showpic>2) showpic=0;
  }
 }


 }

 window.setInterval("Animuj()", 50);

This is how public money is spent in poland

By Anonymous, 2019-05-29 18:35:09
public IsTrueWithNewTokenResponse isVoice(String token){
    IsTrueWithNewTokenResponse isTrue = isWhatever(token, 0)
    resultStatus.success = isTrue.generalResultResponse.success;
    resultStatus.statusCode = isTrue.generalResultResponse.statusCode;
    resultStatus.statusDescription  = isTrue.generalResultResponse.statusDescription;
    if(isTrue != null && isTrue.generalResultResponse != null && isTrue.generalResultResponse.success){
        isTrue.isTrue = !isTrue.isTrue
        return isTrue
    } else {
        return isTrue
    }
}
By Anonymous, 2017-12-18 09:11:43
private static final double RESULT_OF_DIVISION_BY_0 = 9.99;

public static double getPercentageDifference(long currentResult, long previousResult) {
    if (previousResult == 0 && currentResult == 0) {
        return 0;
    } else if (previousResult == 0) {
        return RESULT_OF_DIVISION_BY_0;
    } else {
        return (currentResult - previousResult) * 1.0 / previousResult;
    }
}
By Anonymous, 2017-12-20 10:56:50
// check if user is valid or not
ValidUserValidationResult userValidationResult = validUserValidator.validateUser(validationRequest);
By Anonymous, 2020-12-09 17:45:18
typedef NS_ENUM(NSUInteger, MyEnum1) {
    PackagesNo1 = 1,
    PackagesNo2 = 2,
    PackagesNo4 = 4,
    PackagesNo8 = 8
};

typedef NS_ENUM(NSUInteger, MyEnum2) {
    LEVEL0 = 0,
    LEVEL1 = 1,
    LEVEL2 = 2,
    LEVEL3 = 3
};

- (int)packagesNeededForLevel:(int)level {
    switch (level) {
        case LEVEL0:
            return PackagesNo8;
        case LEVEL1:
            return PackagesNo4;
        case LEVEL2:
            return PackagesNo2;
        case LEVEL3:
            return PackagesNo1;
    }
}

well done mr junior

By Anonymous, 2021-04-12 09:37:34