<?php
if(!defined('WPINC')) // MUST have WordPress.
	exit ('Do not access this file directly.');
	
	if(!class_exists('pluginName_options_page_class'))
{
	/**
	 * Menu page blah
	 *
	 * @package blah
	 * @since 140617
	 */
	class pluginName_options_page_class
	{
		public function __construct()
		{
			echo '<div class="wrap menu-page">'."\n";

			echo '<div class="wp-header-end"></div>'."\n";

			echo '<div class="menu-page-toolbox">'."\n";
			pluginName_some_other_class::display();
			echo '</div>'."\n";

			echo '<h2>Options</h2>'."\n";

			echo '<table class="menu-page-table">'."\n";
			echo '<tbody class="menu-page-table-tbody">'."\n";
			echo '<tr class="menu-page-table-tr">'."\n";
			echo '<td class="menu-page-table-l">'."\n";

			echo '<form method="post" name="plugin_options_form" id="plugin--options-form" autocomplete="off">'."\n";
			echo '<input type="hidden" name="plugin_options_save" id="plugin--options-save" value="'.esc_attr(wp_create_nonce('plugin--options-save')).'" />'."\n";

			echo '<div class="menu-page-group" title="Account Details">'."\n";
			
			/* includes things like this gem */
			echo (!is_multisite() || !pluginName_utils_conds::is_multisite_farm() || is_main_site()) ? '<p>[ Really Long message about something ]</p>'."\n" : '';

			/* ... continues until end ... */

			echo '</div>'."\n";
		}
	}
}

new pluginName_options_page_class ();

The entire file is a single class with a constructor. The constructor is ~ 1150 lines of echo statements with a few PHP conditionals thrown in. There are no other methods. The class is instantiated as soon as it is defined. Clever...

By Anonymous, 2020-11-10 06:08:16
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
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
$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
cd /some/directory
rm -rf *

I regularly see these two lines in Bash scripts I don't understand but some programmers think you need a CD command before any command, and they also don't know that paths can be part of parameters (which explains why they use many CD commands)

By Meeeeee, 2023-01-25 16:50:10
// 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
#265 PHP +18
if((strtotime(date("Y-m-d"))-strtotime(date("Y-m-d", filemtime($filename))))/(3600)<=$config->hourDiff) return true; else return false;

please notice the brackets around 3600

By Anonymous, 2018-03-13 21:56:00
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
spring.datasource.password=#{@secretsManager.getJsonField('${DSP_DB_SECRET:}', 'password', @secretsManager.getString('${DSP_DB_PASSWORD_SECRET:}', '${DSP_DB_PASSWORD:}'))}

String boot, 3 env variables written as string containing code executable code which cannot be verified by compiler. Welcome to Java

By 7bits, 2022-02-01 19:17:55
while (true) {
  if ($current === $requested) {
     break;
  }
  if (! in_array($requested, $available)) {
     break;
  }
  session()->put('locale', $requested);
  break;
}
By Ed, 2020-08-05 15:26:32
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
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
// 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