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
String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1);};
String.prototype.followCase=function(b){
	if(b==b.toUpperCase()){return this.toUpperCase();}
	if(b==b.toLowerCase()){return this.toLowerCase();}
	if(b==b.capitalize()){return this.capitalize();}
	return this;
};
String.prototype.atRemoveAdd=function(index,n,string){
	return this.substring(0,index)+string+this.substring(index+n,this.length);
};
String.prototype.matchIndex=function(re){
	var a=[];
	while((match=re.exec(this))!==null){
		a.push({chars:match[0].length,index:match.index});
	}
	return a;
};
String.prototype.caseReplace=function(o,n){
	for(var s=this,a=this.matchIndex(o),shift=0,i=0;i<a.length;i++){
		var c=n.followCase(this.substring(a[i].index,a[i].index+a[i].chars));
		s=s.atRemoveAdd(a[i].index+shift,a[i].chars,c);
		shift+=c.length-a[i].chars;
	}
	return s;
};

My code from 2016 for the hall of shame where I realized today that caseReplace could just return this.replace(o,m=>n.followCase(m)) instead.

By Anonymous, 2017-12-19 03:55:58
function sortUsers(a, b) {
  return a.last_name.localeCompare(b.last_name) * -1;
}
By Anonymous, 2018-03-06 22:44:30
for (int i = 0;i < n / 2;i++)
    {
        while (num[a[p].id].n == 0 || num[num[a[p].id].nxt].n == 0)
        {
            p++;
        }
        printf("%d %d ", num[a[p].id].n, num[num[a[p].id].nxt].n);
        num[a[p].id].n = 0;
        num[num[a[p].id].nxt].n = 0;
        num[num[a[p].id].lst].nxt = num[num[a[p].id].nxt].nxt;
        num[num[num[a[p].id].nxt].nxt].lst = num[a[p].id].lst;
    }
By Anonymous, 2022-08-06 14:50:56
ngOnInit() {
    this._FunctionService.getSicksList().then(res => {
        let resf:any = res;
        if (resf.err) {
        } else {
            this.diagnosticAll = resf.data
        }
    }, err => { })
}
/*
ngOnInit() {
    this._FunctionService.getSicksList().then(res => {
        this.diagnosticAll = res.data
    }, err => { })
}
*/
By ElkinDev, 2019-06-27 15:18:41
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

Never, ever define developer environment and debug as default thing! #pdk

By kadet, 2021-03-08 23:28:18
	public static <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> String get(A h, B u, C e, F l, G o, D v, E p, H a, I b, L c, K d, N f, J g, P i, M j, N m) {
        StringBuilder yes = new StringBuilder();
        yes.append((String) String.valueOf(h.toString()));
        yes.append((String) String.valueOf(u.toString()));
        yes.append((String) String.valueOf(e.toString()));
        yes.append((String) String.valueOf(l.toString()));
        yes.append((String) String.valueOf(o.toString()));
        yes.append((String) String.valueOf(v.toString()));
        yes.append((String) String.valueOf(p.toString()));
        yes.append((String) String.valueOf(a.toString()));
        yes.append((String) String.valueOf(b.toString()));
        yes.append((String) String.valueOf(c.toString()));
        yes.append((String) String.valueOf(d.toString()));
        yes.append((String) String.valueOf(f.toString()));
        yes.append((String) String.valueOf(h.toString()));
        yes.append((String) String.valueOf(g.toString()));
        yes.append((String) String.valueOf(i.toString()));
        yes.append((String) String.valueOf(j.toString()));
        return (String) String.valueOf(yes.toString());
	}

why

By fxcil, 2022-03-24 21:53:11
 SELECT CAST(CASE a8900.AllowCloserChanges
             WHEN 0
             THEN 0
             ELSE 1 END AS BIT) AllowCloserChanges
 FROM Vision.sub8900.tApplication8900 a8900 
 WHERE a8900.ApplicationNum = @ApplicationNum

Inheriting others' code in the fun world of corporate development.

By The snitch, 2017-12-15 21:21:56
// We have this enum.
enum Formula {
  case proposition(String)
  indirect case negation(Formula)
  indirect case operation(op: String, lhs: Formula, rhs: Formula)

  var nnf: Formula { /* ... */  }
}

// And now ...

switch formula.nnf {
 case .proposition(_):
   return formula.nnf
 case .negation(_):
   return formula.nnf
 case .operation(_, _, _):
   return formula.nnf
}
By Anonymous, 2018-01-08 11:04:54
  $guard = ($vars->a_payment) + (0) * $price;
  if ($bless >= $guard) {
    $amount = $bless;
  }

Why not to write just 1 line?! $amount = max($bless, $vars->a_payment);

By Anonymous, 2018-02-05 17:27:25
        /// <summary>
        /// Builds the suffixs for the request sequence number
        /// </summary>
        /// <param name="i"></param>
        /// <returns></returns>
        public static string GetSequenceNumber(int i)
        {
            string strCount = string.Empty;
            string increase = string.Empty;
            int count;
            strCount = i.ToString();
            count = strCount.Length;
            //Add 0 infront of the index to make a 4 digit number
            if (count < 5)
            {
                for (int j = 0; j < (4 - count); j++)
                {
                    increase = increase + "0";
                }
                strCount = increase + strCount;
            }
            return strCount;
        }
By Anonymous, 2021-04-21 16:01:46
$orderDateTS = strtotime($data['ordertime']);
$nowTS = strtotime('now');
$diff = $nowTS - $orderDateTS;
$diff = $diff / 86400;
$dayDiff = floor($diff);

found in a shopware plugin

By Anon, 2020-04-03 14:16:07
if (code === null) {
    return null;
} else {
    return code;
}
By crossthedev, 2018-11-19 15:33:47
if(!isset($obj->{'s5_4-1'})) {
	$obj->{'s5_4-1'} = 0;
}
if(!isset($obj->{'s5_4-2'})) {
	$obj->{'s5_4-2'} = 0;
}
if(!isset($obj->{'s5_4-3'})) {
	$obj->{'s5_4-3'} = 0;
}
if(!isset($obj->{'s5_4-4'})) {
	$obj->{'s5_4-4'} = 0;
}
By Anonymous, 2017-02-14 20:33:40
try:
    raise
except RuntimeError:
    raise

try this in python3

By FranchuFranchu, 2019-03-14 23:10:03