// 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
try:
    raise
except RuntimeError:
    raise

try this in python3

By FranchuFranchu, 2019-03-14 23:10:03
// Save the files for 100 timea in case failed

try {
    for (let i; i <= 100; i++) {
        File.save();
    }
} catch (e) {
    // Save the files for 100 timea since it already failed
    for (let i; i <= 100; i++) {
        File.save();
    }
}
By Anonymous, 2019-09-09 18:23:39
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
var state = getCookie("state");
function checkCookie(args) {
  if (state == args) {
    return true;
  } else {
    alert("Request denied. Invalid auth code provided.");
    return false;
  }
}
const tokenElement = document.getElementsByName("dream");
var loginSrv = checkCookie(getAllUrlParams().state);
document.cookie = `state=${getAllUrlParams().state}; path=/`;
tokenElement.innerText = getAllUrlParams().code;
if (getAllUrlParams().state != loginSrv) {
  alert(`Incorrect auth code provided. The correct code is ${state}`);
}

If they provide the wrong oauth state code, tell the user the correct one!

By Demonitized, 2020-08-31 22:12:37
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
$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(!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
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
j =0
import random
import hashlib
#geetting inputs
c = input("data  ")
n= int(input("N(the count of last numbers)=  "))
v= input(str(n)+" last char  ")
#list of alphas
l1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'u']
l2 = ["A", 'B', 'C', 'D', 'E', 'F','G' , 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'U']
alphas= 0
#calc the count of alppphas
x=""
for j in c:
    if(j in l1 or j in l2):
        alphas +=1
#positions
h = 2**alphas
hs = []
cc =0
j=0
xf =0
# the stat of main coode
for j in range(h):
    #making a sring with 1 and 0
    while True:
        x=""
        for i in range(len(c)):
            x+=str(random.randint(0,1))
        if(not(x in hs)):
            hs.append(x)
            break
    Xx =""
    cc =0
    #convert that to lower and upper
    for j1 in x:
        if(j1=="0"):
            Xx+=c[cc].lower()
        else:
            Xx+=c[cc].upper()
        cc+=1
    #hash
    m = hashlib.sha256()
    m.update(Xx.encode('utf-8'))
    h = m.hexdigest()
    #if
    if(h[0-n:]==v):
        print("text :"+Xx)
        print("hash :"+h)
        xf = True
        break
    if xf==True:
        break
j =0
#if that not possible to have git push -Desirable-hash by changed lower to upper and upper to lower
if(xf==0):
    while 1:
        j+=1
        d = c+str(j)
        m = hashlib.sha256()
        m.update(d.encode('utf-8'))
        h = m.hexdigest()
        if(h[0-n:]==v):
            print("text :"+d)
            print("hash :"+h)
            break
x = input("press enter to exit")0

this program take a string from you and give you a Desirable-hash by changing lower to upper and changing lower to upper if that possible

By shamsnaamir, 2019-12-13 10:04:28
	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
function prepareKeyword($keyword) {
    $keyword  = html_entity_decode($keyword);
    $keyword  = html_entity_decode($keyword);
    $keyword  = html_entity_decode($keyword);
    $keyword  = iconv("ISO-8859-1", "UTF-8", $keyword);
    $keyword  = cleanString($keyword);
    $keyword  = html_entity_decode($keyword);
    if ($keyword != "") {
        $keyword = mb_strtolower($keyword, "UTF-8");
        $keyword = htmlentities($keyword, ENT_HTML5);
    }
    return $keyword;
}
By Anonymous, 2017-12-15 22:05:55
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