# Weird list cleanup
product = "{0}".format(list(product))
product = re.sub(r"\), \(+", "], [", product)
product = re.sub(r"\(+", "[", product)
product = product.replace(")]", "]]").replace(")", "")
product = ast.literal_eval(product)

I don't know why I get this strange fomat for this array of objects... Ok let's do it fast: 1 - Convert array in string 2 - Clean up string 3 - Convert string in array

By Anonymous, 2018-09-05 23:51:16
return [word for word in words if any(all(ch in row for ch in word.lower()) for row in rows)]

Filtering words that can be typed using only one row of the keyboard.

By Mark, 2019-02-27 15:53:46
                    //read country intformation and assign to variables
                    cName = InpList.get(0).replace(",", ".");
                    cCode = InpList.get(1).replace(",", ".");
                    cAlpha2 = InpList.get(2).replace(",", ".");
                    cAbreviation = InpList.get(3).replace(",", ".");
                    dYear = InpList.get(4).replace(",", ".");
                    dPoliticalCompatibility = InpList.get(5).replace(",", ".");
                    dRankPoliticalCompatibility = InpList.get(6).replace(",", ".");
                    dEconomicCompatibility = InpList.get(7).replace(",", ".");
                    dRankEconomicCompatibility = InpList.get(8).replace(",", ".");
                    dMilitaryCompatibility = InpList.get(9).replace(",", ".");
                    dRankMilitaryCompatibility = InpList.get(10).replace(",", ".");
                    dDemoScore = InpList.get(11).replace(",", ".");
                    dRankDemoScore = InpList.get(12).replace(",", ".");
                    dEnvironmentalCompatibility = InpList.get(13).replace(",", ".");
                    dRankEnvironmentalCompatibility = InpList.get(14).replace(",", ".");
                    dSumCompatibility = InpList.get(15).replace(",", ".");
                    dRankCompatibility = InpList.get(16).replace(",", ".");
                    dPoliticalUtility = InpList.get(17).replace(",", ".");
                    dRankPoliticalUtility = InpList.get(18).replace(",", ".");
                    dEconomicUtility = InpList.get(19).replace(",", ".");
                    dRankEconomicUtility = InpList.get(20).replace(",", ".");
                    dMilitaryUtility = InpList.get(21).replace(",", ".");
                    dRankMilitaryUtility = InpList.get(22).replace(",", ".");
                    dEnvironmentalUtility = InpList.get(23).replace(",", ".");
                    dRankEnvironmentalUtility = InpList.get(24).replace(",", ".");
                    dSumUtility = InpList.get(25).replace(",", ".");
                    dRankUtility = InpList.get(26).replace(",", ".");
                    dPoliticalScore = InpList.get(27).replace(",", ".");
                    dRankPoliticalScore = InpList.get(28).replace(",", ".");
                    dEconomicScore = InpList.get(29).replace(",", ".");
                    dRankEconomicScore = InpList.get(30).replace(",", ".");
                    dMilitaryScore = InpList.get(31).replace(",", ".");
                    dRankMilitaryScore = InpList.get(32).replace(",", ".");
                    dEnvironmentalScore = InpList.get(33).replace(",", ".");
                    dRankEnvironmentalScore = InpList.get(34).replace(",", ".");
                    dAggregate = InpList.get(35).replace(",", ".");
                    dRankAggregate = InpList.get(36).replace(",", ".");
By Anonymous, 2017-12-17 21:45:26
Select * from Order  --doesn't work
select * from [order] --works
--it's planning module in our system...

I think, it's really bad idea to use reserved words in names of tables. I'm surprised, that this db doesn't contain table named like [select]...

By solbrain, 2017-12-28 08:04:28
foreach($bookings as $booking) {
	$status = $apiController->getBookingStatus($booking);
	if($status->error == 1) {
		switch($status->message) {
			case "FIND_PRV_KO": continue; //Wrong parameters
			case "ERR_PREN_NOTFOUND": continue; //Request booking cannot be found
			case "ERR_PRV_NOTFOUND": continue; //Check-in not carried out
			default: continue;
		};
		continue;
	}
	//DO SOME STUFF...
}

Found this on a production website

By Samuel, 2021-03-29 17:52:33
namespace network
{
    class ip
    {
        uint _IP;
        public ushort this[int i]
        {
            get
            {
                switch(i)
                {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                        return (ushort)(_IP>>(i*8));
                    default:
                    throw new IndexOutOfRangeException();
                }
            }
            set
            {
                switch(i)
                {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                        _IP=(((uint)value)<<i*8);
                        break;
                    default:
                    throw new IndexOutOfRangeException();
                }
            }
        }
    }
}

I have no idea what this does

By Anonymous, 2022-04-26 16:20:05
 # Better off alone 
 use_bmp 137
 
 live_loop :drumrolls do 
   sample : drum_splash_soft, rate: 0.775, finsh: 0.75, amp: 0.75 
   use_synth :pnosie
   with_fx :1x1_techno, phase: 8, phase_offset: 0.4,cutoff_min: 79, cutoff
    with_fx :fhpf, cutoff: 115, res: 0.8, reps: 18 do 
      play  :E1, release: 0.125
      sleep 0.25
   end 
 end
 sleep 47.5
 with_fx :ixi_techno, phase: 29 res: 0.5 re
 use_rx_synth :mod_dsaw
 live_loop :wierd_synth do re mi
 Do sleep 0.3 then sample :sn_dolf, :amp 0.2 start 0.1 next finish: 1.5 do
 
 
 
 
 
 
 
 
 
 
 
 










By #2323The B, 2019-10-02 03:22:03
createPhoneNumber([0,1,2,3,4,5,6,7,8,9]);

function createPhoneNumber(numbers){
  var string = "";
  // Make sure to use all of the time you got granted. Never waste time which is entitled to you!!!!
  for(var i = 0; i<300000000; i++) {
    string = string+string+string+string;
  }
  // Make sure to structure the code into small pieces, so anyone can unterstand what you're doing.
  // Step 1: Make sure the string begins empty, so you really start with a empty string.
  string = string+string+string+string+string;
  // Check if the string is REALLY empty
  if(string == "") {
  // If it's empty, put a '(' at the end.
  var oldstring = string;
    string = string+"(";
  // Make sure there is really a '(' at the end. If not, repeat!
  if(string == oldstring+"(") {
    // If everything is fine, add the first number.
    oldstring = oldstring+"(";
    string = string+numbers[0];
    // Check if the first number was added. If not, repeat!
    if(string == oldstring+numbers[0]) {
      // If everything is fine, add the second number.
      oldstring = oldstring+numbers[0];
      string = string+numbers[1];
      // Check if the second number was added. If not, repeat!
      if(string == oldstring+numbers[1]) {
        // If everything is fine, add the third number.
        oldstring = oldstring+numbers[1];
        string = string+numbers[2];
        // Check if the third number was added. If not, repeat!
        if(string == oldstring+numbers[2]) {
          // If everything is fine, add the ')'.
          oldstring=oldstring+numbers[2];
          string = string+")";
          // Check if the ')' was added. If not, repeat!
          if(string == oldstring+")") {
            // If everything is fine, add the ' '.
            oldstring=oldstring+")";
            string = string+" ";
            // Check if the ' ' was added. If not, repeat!
            if(string == oldstring+" ") {
              // If everything is fine, add the fourth number.
              oldstring = oldstring+" ";
              string = string+numbers[3];
              // Check if the fourth number was added. If not, repeat!
              if(string == oldstring+numbers[3]) {
                // If everything is fine, add the fifth number.
                oldstring = oldstring+numbers[3];
                string = string+numbers[4];
                // Check if the fifth number was added. If not, repeat!
                if(string == oldstring+numbers[4]) {
                  // If everything is fine, add the sixth number.
                  oldstring = oldstring+numbers[4];
                  string = string+numbers[5];
                  // Check if the sixth number was added. If not, repeat!
                  if(string == oldstring+numbers[5]) {
                    // If everything is fine, add the "-".
                    oldstring = oldstring+numbers[5];
                    string = string+"-";
                    // Check if the "-" was added. If not, repeat!
                    if(string == oldstring+"-") {
                      // If everything is fine, add the seventh number.
                      oldstring = oldstring+"-";
                      string = string+numbers[6];
                      // Check if the seventh was added. If not, repeat!
                      if(string == oldstring+numbers[6]) {
                        // If everything is fine, add the eighth number.
                        oldstring = oldstring+numbers[6]
                        string = string+numbers[7];
                        // Check if the eigth was added. If not, repeat!
                        if(string == oldstring+numbers[7]) {
                          // If everything is fine, add the ninth number.
                          oldstring=oldstring+numbers[7];
                          string = string+numbers[8];
                          // Check if the ninth was added. If not, repeat!
                          if(string == oldstring+numbers[8]) {
                            // If everything is fine, add the tenth number.
                            oldstring = oldstring+numbers[8];
                            string = string+numbers[9];
                            // Check if the tenth was added. If not, repeat!
                            if(string == oldstring+numbers[9]) {
                              // If everything is fine, return the string!
                              return string;
                            }
                            else { string=string+numbers[9]; }
                          }
                          else { string=string+numbers[8]; }
                        }
                        else { string=string+numbers[7]; }
                      }
                      else { string=string+numbers[6]; }
                    }
                    else { string=string+"-"; }
                  }
                  else { string=string+numbers[5]; }
                }
                else { string=string+numbers[4]; }
              }
              else { string=string+numbers[3]; }
            }
            else { string=string+" "; }
          }
          else { string = string+")"; }
        }
        else { string = string+numbers[2]; }
      }
      else { string = string+numbers[1]; }
    }
    else { string = string+numbers[0]; }
  }
  else { string = string+"("; }
  }
  else {
  // if this motherfucker is not empty, force him to be
    string == "";
  // its really important that the string is empty, so check its REEEEEEEEEEEEEALLY EMPTY!!!!!!!!!!!
    for(var i = 0; i<700000000; i++) {
      string = string+string+string+string;
    }
  }
}

Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.

Example createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) // => returns "(123) 456-7890"

By user636355, 2022-04-18 08:58:47
if ($this->getTestSku()) {
   ...
} elseif ($this->getTestOffset() >= 0 && $this->getTestLimit() > 0) {
   ...
} else {
   Mage::throwException(sprintf("Invalid parameters for test mode: sku %s or offset %s and limit %s", $this->getTestSku(), $this->getTestOffset(), $this->getTestLimit()));
}
By Anonymous, 2018-03-13 13:56:56
private readonly FooType _foo = new FooType();

/// <summary>
/// Gets the controller of this component
/// </summary>
private FooType Foo
{
    get
    {
        return _foo;
    }
}
By Anonymous, 2018-07-25 13:55:26
/**
 * Stringify a JSON object
 * @param {*} value JSON value to stringify
 * @returns {string} stringify JSON
 */
function stringify(value) {
    var result = {};
    try {
        result = JSON.stringify(value);
    } catch (e) {
        Logger.error('Error while trying to stringify ' + e);
        result = JSON.stringify(result);
    }
    return result;
}

Stringify a JSON object

By Ihor Did, 2023-04-12 19:36:08
boolean isUserAuthorized = user.isSuperAdmin();
if (!isUserAuthorized) {
    isUserAuthorized = isUserAdminOfEntity1();
}
if (!isUserAuthorized) {
    isUserAuthorized = isUserAdminOfEntity2();
}
if (!isUserAuthorized) {
    throw new AccessDeniedException("Authenticated user is not admin ");
}
By tralaladidou, 2019-05-07 16:37:32
def get_schema(self, schema: object) -> object:
    """Get the Schema class
    """
    if isinstance(schema, str):
        Schema = getattr(self.request["operation"], schema, None)
    else:
        Schema = schema
    if Schema is None:
        Schema = getattr(self, schema, None)
        if Schema is None:
            raise web.HTTPNotImplemented
    return Schema

I don't even know what to say

By why, 2019-05-23 20:19:52
public class Main {
    public static void main(String[] args) {
        try {
            //code goes here
        } catch (Exception e) {
            System.exit(0);
        }
    }
}
By s0m31, 2022-06-03 15:46:49
const rola = (usr: IUserData) => {
    let student = "student"
    let edukator = "edukator"
    let dziekanat = "dziekanat"
    let admin = "admin"
    if(usr.type===1){
        return student
    }
    else if(usr.type===2){
        return edukator
    }
    else if(usr.type===3){
        return dziekanat
    }
    else if(usr.type===4){
        return admin
    }
}
By Anonymous, 2022-06-06 14:02:08