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
function edit_vehality: locality,
      google_place_id: '1'
    };
    let opts = { 'method': 'put', 'route': '/border/' + border_id, 'status': status, 'account_access_token': saved_values.superadmin.account_access_token, 'params': params };
    request(opts)
      .then(function(res) {
        resolve(res.result);
      }).catch(reject);
  })
}
By a poor soul, 2018-04-11 17:07:13
public class MandateData {

    public final UUID coreId;
    public final UUID accountId;
    public final String accountRef;
    public final String creditorId;
    public final String creditorName;
    public final String debtorFirstName;
    public final String debtorLastName;
    public final String branchCode;
    public final String accountNumber;
    public final LocalDate signingDate;
    public final Address debtorAddress;

    private MandateData(UUID coreId, UUID accountId, String accountRef, String creditorId, String creditorName, String branchCode, String accountNumber, String debtorFirstName, String debtorLastName,
                        LocalDate signingDate, Address debtorAddress) {
        this.coreId = coreId;
        this.accountId = accountId;
        this.accountRef = accountRef;
        this.creditorId = creditorId;
        this.creditorName = creditorName;
        this.debtorFirstName = debtorFirstName;
        this.debtorLastName = debtorLastName;
        this.branchCode = branchCode;
        this.accountNumber = accountNumber;
        this.signingDate = signingDate;
        this.debtorAddress = debtorAddress;
    }

    public static MandateData creationMandateData(UUID coreId, UUID accountId, String accountRef, String creditorId, String creditorName, String branchCode, String accountNumber, String debtorFirstName, String debtorLastName,
                                                  LocalDate signingDate, Address debtorAddress) {
        return new MandateData(coreId, accountId, accountRef, creditorId, creditorName, branchCode, accountNumber, debtorFirstName, debtorLastName, signingDate, debtorAddress);
    }
}

There is an ancient and mysterious legend about public static constructor, called createShit. If anyone want's just to create an instance of Shit be aware of it! This is too obvious! just Implement static method with the exactly the same fields, and make constructor private. Don't write a shit!

By Anonymous, 2018-06-07 13:03:44
const setFormFlag(state){
    state.formFlag ? state.formFlag = false : state.formFlag = true;
}
By Apeiron, 2018-07-27 20:43:23
nohup find dump_events/* -type f -name "*.jpg" -exec bash -c "cp -v {} \"backup_events/\`ls {} --full-time --time-style="+%Y-%m-%d_%H-%M-%S" | cut -d ' ' -f 6 \`_\`md5sum {} | cut -d ' ' -f 1\`.jpg\";" \; & 

Let's do this... I may also add this... And this... And that... And the other thing there... Then calculate how flat the earth is... But in one line!

By Bazhmania, 2018-12-04 10:20:40

    def dow_to_dict_from_self(self):
        # res = {'name': self.name, 'enabled': self.enabled }
        res = {'sun': 0, 'mon': 0, 'tue': 0, 'wed': 0, 'thr': 0, 'fri': 0,
               'sat': 0,
               'enabled': 0, 'dow': 0, 'name': 'untitled'}

        if (int(self.days_of_week) & 0x01) == 0x01:  # sun
            res['sun'] = 1
        if (int(self.days_of_week) & 0x02) == 0x02:  # mon
            res['mon'] = 1
        if (int(self.days_of_week) & 0x04) == 0x04:  # tue
            res['tue'] = 1
        if (int(self.days_of_week) & 0x08) == 0x08:  # wed
            res['wed'] = 1
        if (int(self.days_of_week) & 0x10) == 0x10:  # thr
            res['thr'] = 1
            res['thu'] = 1  # '%a' returns thu for Thursday
        if (int(self.days_of_week) & 0x20) == 0x20:  # fri
            res['fri'] = 1
        if (int(self.days_of_week) & 0x40) == 0x40:  # sat
            res['sat'] = 1
        if (int(
                self.days_of_week) & 0x40) == 0x80:  # enabled # new enable#
            # flag -- duplicate in db
            res['enabled'] = 1

        res['enabled'] = self.enabled  # remove this
        res['dow'] = self.days_of_week
        res['name'] = self.name

        return res

kept the original comments - they're very helpful

By Anonymous, 2018-07-11 19:40:44
    if (preg_match("/^N/",$postcode)) {
        if (preg_match("/^NW/", $postcode)) {
            if (!preg_match("/^NW1/", $postcode)) {
                // NORTH WEST (NW2, NW3, NW4, NW5, NW6, NW7, NW8, NW9, NW10)
                $property['Prop_area'] = 'NW';
            } else {
                // NW1 which is Central
                $property['Prop_area'] = 'SW';
            }
        } else {
            // NORTH  (N1, N2, N3, N4, N5 etc)
            $property['Prop_area'] = 'N';
        }
    } else if (preg_match("/^W/",$postcode)) {
        if (
            !preg_match("/^W1 /",$postcode)
            && !preg_match("/^W2 /",$postcode)
            && !preg_match("/^W8/",$postcode)
            && !preg_match("/^W11/",$postcode)
        ) {
            // WEST includes (W3, W4, W5, W6, W7, W9, W10, W12, W13, W14)
            $property['Prop_area'] = 'W';
        } else {
            //W1 and W2, W8, W11 which are Central
            $property['Prop_area'] = 'SW';
        }
    } else {
        if (
            preg_match("/^SW/",$postcode)
            || preg_match("/^EC/",$postcode)
            || preg_match("/^WC/",$postcode)
        ) {
            // CENTRAL includes (W1, W2, EC, WC, NW1, SW1, SW3, SW5, SW7, W8, W11)
            $property['Prop_area'] = 'SW';
        } else {
            // OTHER includes South and East and everything else
            return 'SE';
        }
    }
By ichikawayukko, 2018-11-06 12:30:21
import cv2
import numpy as np

cap = cv2.VideoCapture(0)

while (1):

    _, frame = cap.read()

    hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)

    lower_green = np.array([40, 50, 50])
    upper_green = np.array([80, 102, 200])

    # Threshold the HSV image to get only green colors
    mask = cv2.inRange(hsv, lower_green, upper_green)

    total_pixels = mask.shape[0] * mask.shape[1]
    print "Number of pixels: %", total_pixels

    pixel_counter = 0
    x_counter = 0
    y_counter = 0
    for y in xrange(640):
        for x in xrange(480):
            pixel = mask[x, y]
            if pixel == 255:
                pixel_counter += 1
                x_counter += x
                y_counter += y
    x_center = x_counter / pixel_counter
    y_center = y_counter / pixel_counter
    print x_center, y_center

    cv2.line(frame, (x_center+15, y_center), (x_center+2, y_center), (235, 218, 100), 1)
    cv2.line(frame, (x_center-15, y_center), (x_center-2, y_center), (235, 218, 100), 1)
    cv2.line(frame, (x_center, y_center+15), (x_center, y_center+2), (235, 218, 100), 1)
    cv2.line(frame, (x_center, y_center-15), (x_center, y_center-2), (235, 218, 100), 1)

    cv2.circle(frame, (x_center, y_center), 4, (235, 218, 100), 2)

    cv2.imshow('frame', frame)

    k = cv2.waitKey(5) & 0xFF
    if k == 27:
        break

cv2.destroyAllWindows()

track the green color

By Vik.victory, 2017-06-23 19:11:14
private <T> Supplier<T> abort(Class<T> exception) {
  return () -> {
    try {
      return exception.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  };
}

...

throw abort(MyException.class).get();
By Anonymous, 2017-12-14 11:27:50
# 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
// Number 1:

onClipEvent(load){
   risespeed = 8;
   waittime = _root.framerate * 7.5;
   count = _root.framerate * 1;
   groundwaittime = _root.framerate * 1;
}

// Number 2:

gotoAndStop(Math.round(frame) * 1 / 1);

// Number 3:

_root.DoorTrasition = function(doorplace)
{
   if(doorplace == "XY")
   {
      _root.Course.Char._x = _root.WarpPipeX + _root.Course.BackGFX._x;
      _root.Course.Char._y = _root.WarpPipeY + _root.Course.BackGFX._y;
      _root.Course.Char.attack = false;
      _root.attachMovie("StarIn","Transition",_root.getNextHighestDepth(),{_x:_root.screensizeX / 2,_y:_root.screensizeY / 2});
   }
   else if(doorplace == "inCastle")
   {
      _root.StartInsideofCastle();
   }
   else if(doorplace == "outCastle")
   {
      _root.RemoveCourse();
      _root.gotoAndStop("Courseframe");
      _root.StartChar("Castle",0,50,0,50,150,_root.CurrentPlayer,_root.Fluddpow,"StarIn",true);
      _root.onEnterFrame = function()
      {
         _root.CharCode();
      };
   }
   else if(doorplace == "C-MR")
   {
      _root.changecourse("StarIn","C-4-SC1",-674,-60,-674,-60);
   }
   else if(doorplace == "C-MR-back")
   {
      _root.changecourse("StarIn","C-4",1260,0,1260,0);
   }
   else if(doorplace == "C-1-1")
   {
      _root.changecourse("StarIn","C-1",0,0,0,0);
   }
   else if(doorplace == "Castle-02")
   {
      _root.changecourse("StarIn","Castle",1400,390,1400,390,true);
   }
   else if(doorplace == "C-1-2")
   {
      _root.changecourse("StarIn","C-1",-550,-60,-550,-60);
   }
   else if(doorplace == "C-1-3")
   {
      _root.changecourse("StarIn","C-1",550,-60,550,-60);
   }
   else if(doorplace == "C-1-4")
   {
      _root.changecourse("StarIn","C-1",0,-195,0,-195);
   }
   else if(doorplace == "C-1-5")
   {
      _root.changecourse("StarIn","C-1",160,0,160,0);
   }
   else if(doorplace == "C-1-6")
   {
      _root.changecourse("StarIn","C-1",-160,0,-160,0);
   }
   else if(doorplace == "C-1-7")
   {
      _root.changecourse("StarIn","C-1",460,-200,460,-200);
   }
   else if(doorplace == "C-1-8")
   {
      _root.changecourse("StarIn","C-1",-460,-200,-460,-200);
   }
   else if(doorplace == "C-1-9")
   {
      _root.changecourse("StarIn","C-1",-390,-16,-390,-16);
   }
   else if(doorplace == "C-1-10")
   {
      _root.changecourse("StarIn","C-1",390,-16,390,-16);
   }
   else if(doorplace == "C-2-1")
   {
      _root.changecourse("StarIn","C-2",0,0,0,0);
   }
   else if(doorplace == "C-2-2")
   {
      _root.changecourse("StarIn","C-2-2",0,0,0,0);
   }
   else if(doorplace == "C-3-1")
   {
      _root.changecourse("StarIn","C-3",0,0,0,0);
   }
   else if(doorplace == "C-3-2")
   {
      _root.changecourse("StarIn","C-3-2",0,0,0,0);
   }
   else if(doorplace == "C-4-1")
   {
      _root.changecourse("StarIn","C-4",0,0,0,0);
   }
   else if(doorplace == "C-4-2")
   {
      _root.changecourse("StarIn","C-4",-846,-406,-846,-400);
   }
   else if(doorplace == "C-4-L")
   {
      if(_root.CurrentPlayer !== "Luigi")
      {
         _root.CurrentPlayer = "Luigi";
      }
      else
      {
         _root.CurrentPlayer = "Mario";
      }
      _root.changecourse("StarIn","C-4",1100,0,1100,0);
   }
   else if(doorplace == "C-4H-1")
   {
      _root.changecourse("StarIn","C-4H",0,0,0,0);
   }
   else if(doorplace == "C-4H-2")
   {
      _root.changecourse("StarIn","C-4H",0,0,382,-85);
   }
   else if(doorplace == "C-4H-sd")
   {
      _root.changecourse("StarIn","C-4H",400,-365,400,-365);
   }
   else if(doorplace == "C-4H-3")
   {
      _root.changecourse("StarIn","C-4H",0,-300,20,-575);
   }
   else if(doorplace == "C-5-1")
   {
      _root.changecourse("StarIn","C-5",0,0,0,0);
   }
   else if(doorplace == "C-6-1")
   {
      _root.changecourse("StarIn","C-6",250,0,250,0);
   }
   else if(doorplace == "C-6-2")
   {
      _root.changecourse("StarIn","C-6",-250,0,-250,0);
   }
   else if(doorplace == "C-6-3")
   {
      _root.changecourse("StarIn","C-6",0,-95,0,-95,true);
   }
   else if(doorplace == "C-6-4")
   {
      _root.changecourse("StarIn","C-6",0,80,0,80);
   }
   else if(doorplace == "C-7-1")
   {
      _root.changecourse("StarIn","C-7",0,0,0,0);
   }
   else if(doorplace == "C-7-2")
   {
      _root.changecourse("StarIn","C-7",-820,12,-820,12);
   }
   else if(doorplace == "C-7-3")
   {
      _root.changecourse("StarIn","C-7",610,40,610,40);
   }
   else if(doorplace == "C-8-1")
   {
      _root.changecourse("StarIn","C-8",0,0,0,0);
   }
   else if(doorplace == "C-8-2")
   {
      _root.changecourse("StarIn","C-8",784,-16,784,-16);
   }
   else if(doorplace == "C-8-3")
   {
      _root.changecourse("StarIn","C-8",1201,45,1201,45,true);
   }
   else if(doorplace == "C-9-1")
   {
      _root.changecourse("StarIn","C-9",0,0,0,0);
   }
   else if(doorplace == "C-9-2")
   {
      _root.changecourse("StarIn","C-9",300,-185,300,-185);
   }
   else if(doorplace == "C-10-1")
   {
      _root.changecourse("StarIn","C-10",0,0,0,0);
   }
   else if(doorplace == "C-10-2")
   {
      _root.changecourse("StarIn","C-10",-223,0,-223,0);
   }
   else if(doorplace == "C-10-3")
   {
      _root.changecourse("StarIn","C-10",720,-185,720,-185);
   }
   else if(doorplace == "C-10-sd")
   {
      _root.changecourse("StarIn","C-10",-235,-575,-235,-575);
   }
   else if(doorplace == "C-10-D3")
   {
      _root.changecourse("StarIn","C-10",-170,-512,-170,-512,true);
   }
   else if(doorplace == "C-10-D2")
   {
      _root.changecourse("StarIn","C-10",-235,-512,-235,0);
   }
   else if(doorplace == "C-10-D1")
   {
      _root.changecourse("StarIn","C-10",-297,-512,-297,0);
   }
   else if(doorplace == "C-11-1")
   {
      _root.changecourse("StarIn","C-11",0,0,0,0);
   }
   else if(doorplace == "C-12-1")
   {
      _root.changecourse("StarIn","C-12",0,0,0,0);
   }
   else if(doorplace == "C-12-2")
   {
      _root.changecourse("StarIn","C-12",80,-250,80,-250);
   }
   else if(doorplace == "C-13-1")
   {
      _root.changecourse("StarIn","C-13",0,0,0,0);
   }
   else if(doorplace == "C-O-1")
   {
      _root.changecourse("StarIn","C-O",0,0,0,0,true);
   }
   else if(doorplace == "C-O-2")
   {
      _root.changecourse("StarIn","C-O",300,0,-950,-363,true);
   }
   else if(doorplace == "C-Opening")
   {
      if(_root.Star[39] == true)
      {
         _root.changecourse("righttransition2","Castle",-1300,100,-1300,100);
      }
      else
      {
         _root.bgsong.stop();
         _root.gotoAndStop("Intro2");
         _root.RemoveCourse();
      }
   }
   else if(doorplace == "4-1-1")
   {
      _root.changecourse("StarIn","4-1",610,150,610,150);
   }
   else if(doorplace == "4-1-2")
   {
      _root.changecourse("StarIn","4-1",-315,200,-315,200);
   }
   else if(doorplace == "4-1-3")
   {
      _root.changecourse("StarIn","4-1",610,-810,610,-810);
   }
   else if(doorplace == "4-1-4")
   {
      _root.changecourse("StarIn","4-1",245,-1010,245,-1010);
   }
   else if(doorplace == "4-1-5")
   {
      _root.changecourse("StarIn","4-1",610,-1305,610,-1305);
   }
   else if(doorplace == "4-2-1")
   {
      _root.changecourse("StarIn","4-2",0,0,0,0);
   }
   else if(doorplace == "4-2-2")
   {
      _root.changecourse("StarIn","4-2",-400,0,-400,0);
   }
   else if(doorplace == "4-2-3")
   {
      _root.changecourse("StarIn","4-2",-250,0,-250,0);
   }
   else if(doorplace == "4-2-4")
   {
      _root.changecourse("StarIn","4-2",250,0,250,0);
   }
   else if(doorplace == "4-2-5")
   {
      _root.changecourse("StarIn","4-2",400,0,400,0);
   }
   else if(doorplace == "4-2-6")
   {
      _root.changecourse("StarIn","4-2",-400,-375,-400,-375);
   }
   else if(doorplace == "4-2-7")
   {
      _root.changecourse("StarIn","4-2",-250,-375,-250,-375);
   }
   else if(doorplace == "4-2-8")
   {
      _root.changecourse("StarIn","4-2",250,-375,250,-375);
   }
   else if(doorplace == "4-2-9")
   {
      _root.changecourse("StarIn","4-2",400,-375,400,-375);
   }
   else if(doorplace == "4-2-10")
   {
      _root.changecourse("StarIn","4-2",0,-610,0,-610);
   }
   else if(doorplace == "4-3-1")
   {
      _root.changecourse("StarIn","4-3",0,20,0,20);
   }
   else if(doorplace == "4-3-2")
   {
      _root.changecourse("StarIn","4-3",1300,20,1300,20);
   }
   else if(doorplace == "4-3-3")
   {
      _root.changecourse("StarIn","4-3",0,-780,0,-780);
   }
   else if(doorplace == "4-3-4")
   {
      _root.changecourse("StarIn","4-3",100,-1776,100,-1776);
   }
   else if(doorplace == "4-4-1")
   {
      _root.changecourse("StarIn","4-4",0,20,0,20);
   }
   else if(doorplace == "4-4-2")
   {
      _root.changecourse("StarIn","4-4",-1300,20,-1300,20);
   }
   else if(doorplace == "4-4-3")
   {
      _root.changecourse("StarIn","4-4",0,-780,0,-780);
   }
   else if(doorplace == "4-4-4")
   {
      _root.changecourse("StarIn","4-4",200,-1776,200,-1776);
   }
   else if(doorplace == "4-5-1")
   {
      _root.changecourse("StarIn","4-5",-1300,20,-1300,20);
   }
   else if(doorplace == "4-5-2")
   {
      _root.changecourse("StarIn","4-5",1300,20,1300,20);
   }
   else if(doorplace == "4-6-1")
   {
      _root.changecourse("StarIn","4-6",0,0,0,0);
   }
   else if(doorplace == "4-6-2")
   {
      _root.changecourse("StarIn","4-6",0,-480,0,-480);
   }
   else if(doorplace == "4-7-1")
   {
      _root.changecourse("StarIn","4-7",0,0,0,0);
   }
   else if(doorplace == "4-7-2")
   {
      _root.changecourse("StarIn","4-7",-150,-400,-150,-400);
   }
   else if(doorplace == "4-8-1")
   {
      _root.changecourse("StarIn","4-8",-1350,100,-1350,100);
   }
   else if(doorplace == "4-8-2")
   {
      _root.changecourse("StarIn","4-8",-800,100,-800,100);
   }
   else if(doorplace == "4-8-3")
   {
      _root.changecourse("StarIn","4-8",0,0,0,0);
   }
   else if(doorplace == "4-8-4")
   {
      _root.changecourse("StarIn","4-8",1200,100,1200,100);
   }
   else if(doorplace == "4-8-5")
   {
      _root.changecourse("StarIn","4-8",800,100,800,100);
   }
   else if(doorplace == "4-9-1")
   {
      _root.changecourse("StarIn","4-9",0,0,0,0);
   }
   else if(doorplace == "4-9-2")
   {
      _root.changecourse("StarIn","4-9",-1450,0,-1450,0);
   }
   else if(doorplace == "4-9-3")
   {
      _root.changecourse("StarIn","4-9",0,-1055,0,-1055);
   }
   else if(doorplace == "4-10-1")
   {
      _root.changecourse("StarIn","4-10",-3090,-630,-3090,-630);
   }
   else if(doorplace == "4-11-1")
   {
      _root.changecourse("StarIn","4-11",0,0,0,0,true);
   }
   else if(doorplace == "5-1-1")
   {
      _root.changecourse("StarIn","5-1",620,150,620,150);
   }
   else if(doorplace == "5-1-2")
   {
      _root.changecourse("StarIn","5-1",2980,-50,2980,-50);
   }
   else if(doorplace == "5-5")
   {
      _root.changecourse("StarIn","5-5",0,0,0,0);
   }
   else if(doorplace == "5-7-1")
   {
      _root.changecourse("StarIn","5-7",0,0,0,0);
   }
   else if(doorplace == "5-8-1")
   {
      _root.changecourse("StarIn","5-8",0,0,0,0);
   }
   else if(doorplace == "6-5")
   {
      _root.changecourse("StarIn","6-5",500,500,-600,666,true);
   }
   else if(doorplace == "7-6")
   {
      _root.changecourse("StarIn","7-6",0,0,0,0,true);
   }
   else if(doorplace == "8-1-2")
   {
      _root.changecourse("StarIn","8-1",4128,-10,4128,-10);
   }
   else if(doorplace == "8-2-1")
   {
      _root.changecourse("StarIn","8-2",0,0,0,0);
   }
   else if(doorplace == "8-2-bleft")
   {
      _root.changecourse("StarIn","8-2",-812,-114,-812,-114);
   }
   else if(doorplace == "8-2-bright")
   {
      _root.changecourse("StarIn","8-2",760,-114,760,-114);
   }
   else if(doorplace == "8-2-uleft")
   {
      _root.changecourse("StarIn","8-2",-1350,-420,-1350,-420,true);
   }
   else if(doorplace == "8-2-uright")
   {
      _root.changecourse("StarIn","8-2",830,-420,830,-420);
   }
   else if(doorplace == "8-2-top")
   {
      _root.changecourse("StarIn","8-2",0,-1090,0,-1090);
   }
   else if(doorplace == "8-3")
   {
      _root.changecourse("StarIn","8-3",0,95,0,95);
   }
   else if(doorplace == "8-4")
   {
      _root.changecourse("StarIn","8-4",0,95,0,95);
   }
   else if(doorplace == "8-5")
   {
      _root.changecourse("StarIn","8-5",0,0,0,0,true);
   }
   else if(doorplace == "8-6")
   {
      _root.changecourse("StarIn","8-6",0,0,0,0);
   }
   else if(doorplace == "8-7")
   {
      _root.changecourse("StarIn","8-7",0,0,0,0);
   }
   else if(doorplace == "8-7bleft")
   {
      _root.changecourse("StarIn","8-7",-468,20,-468,20);
   }
   else if(doorplace == "8-7bright")
   {
      _root.changecourse("StarIn","8-7",468,20,468,20);
   }
   else if(doorplace == "8-7uleft")
   {
      _root.changecourse("StarIn","8-7",-556,-577,-556,-577);
   }
   else if(doorplace == "8-7uright")
   {
      _root.changecourse("StarIn","8-7",556,-577,556,-577);
   }
   else if(doorplace == "8-7utop")
   {
      _root.changecourse("StarIn","8-7",0,-582,0,-582);
   }
   else if(doorplace == "8-8")
   {
      _root.changecourse("StarIn","8-8",0,0,0,0);
   }
   else if(doorplace == "8-8u")
   {
      _root.changecourse("StarIn","8-8",-656,-2620,-656,-2620);
   }
   else if(doorplace == "8-9")
   {
      _root.changecourse("StarIn","8-9",0,0,0,0);
   }
   else if(doorplace == "8-9u")
   {
      _root.changecourse("StarIn","8-9",0,0,0,0);
   }
   else if(doorplace == "8-10")
   {
      _root.changecourse("StarIn","8-10",-290,0,-290,0);
   }
   else if(doorplace == "8-10-b")
   {
      _root.changecourse("StarIn","8-10-b",-547,-1470,-547,-1470,true);
   }
   else if(doorplace == "8-10u")
   {
      _root.changecourse("StarIn","8-10-b",-575,-1470,-575,-1470,true);
   }
   else if(doorplace == "8-11")
   {
      _root.changecourse("StarIn","8-11",-170,30,-170,30,true);
   }
   else if(doorplace == "8-11u")
   {
      _root.changecourse("StarIn","8-11",0,-820,0,-820,true);
   }
   else if(doorplace == "8-12")
   {
      _root.changecourse("StarIn","8-12",0,0,0,0);
   }
   else if(doorplace == "8-12-Warp")
   {
      _root.Fluddpow = "";
      _root.StopBGsong();
      _root.lvl8keyA = false;
      _root.lvl8keyB = false;
      _root.lvl8keyC = false;
      _root.lvl8keyD = false;
      _root.lvl8keyE = true;
      _root.Playinglevel = 8;
      _root.SongIntro = "BowserTrapIntro";
      _root.SongRepeat = "BowserTrapRepeat";
      _root.PlayMusicAndIntro();
      _root.changecourse("StarIn","8-12",-192,-52,-192,-52);
   }
   else if(doorplace == "C-13-Warp")
   {
      _root.Fluddpow = "";
      _root.StopBGsong();
      _root.lvl8keyA = false;
      _root.lvl8keyB = false;
      _root.lvl8keyC = false;
      _root.lvl8keyD = false;
      _root.lvl8keyE = true;
      _root.Playinglevel = 0;
      _root.SongIntro = "None";
      _root.SongRepeat = "InsidetheCastleWalls";
      _root.StartNewMusicAndIntroNoVar("BowserPlan-Intro","BowserPlan-Repeat");
      _root.changecourse("StarIn","C-13",1066,-215,1066,-215);
   }
   else if(doorplace == "8-E2-2")
   {
      _root.Fluddpow = "";
      _root.changecourse("StarIn","8-E2-2",0,-200,0,-200,true);
   }
   else if(doorplace == "8-13")
   {
      _root.changecourse("StarIn","8-13",0,0,0,0,true);
   }
   else if(doorplace == "8-E3-1")
   {
      _root.changecourse("StarIn","8-E3-1",0,0,0,0,true);
   }
   else if(doorplace == "8-E5-1")
   {
      _root.Fluddpow = "";
      _root.changecourse("StarIn","8-E5-1",-1693,-60,-1693,-60,true);
   }
   else if(doorplace == "8-E5-1-1")
   {
      _root.Fluddpow = "";
      _root.changecourse("StarIn","8-E5-1",-212,-25,-212,-25,true);
   }
   else if(doorplace == "9-02")
   {
      _root.Restartcoins();
      _root.Fluddpow = "";
      _root.changecourse("StarIn","9-02",0,0,0,0,true);
   }
   else if(doorplace == "9-04")
   {
      _root.Restartcoins();
      _root.Fluddpow = "";
      _root.changecourse("StarIn","9-04",0,0,0,0,true);
   }
   else if(doorplace == "9-06")
   {
      _root.Restartcoins();
      _root.Fluddpow = "";
      _root.changecourse("StarIn","9-06",0,0,0,0,true);
   }
   else if(doorplace == "M1-2")
   {
      _root.changecourse("StarIn","M1-2",-1465,-320,-1465,-320,true);
   }
   else if(doorplace == "M2-1-1")
   {
      _root.changecourse("StarIn","M2-1",795,125,795,125);
   }
   else if(doorplace == "M2-2-1")
   {
      _root.changecourse("StarIn","M2-2",0,0,0,0);
   }
   else if(doorplace == "BC-0")
   {
      _root.gotoAndStop("BowserBattle3");
      _root.RemoveCourse();
   }
   else if(doorplace == "BC-1")
   {
      _root.changecourse("StarIn","BC-1",0,0,0,0);
   }
   else if(doorplace == "C-4-SC1")
   {
      _root.changecourse("StarIn","C-4-SC1",0,0,0,0);
   }
   else if(doorplace == "C-4-SC2")
   {
      _root.changecourse("StarIn","C-4-SC1",0,-260,0,-260);
   }
   else if(doorplace == "C-4-SC1-back")
   {
      _root.changecourse("StarIn","C-4",1164,0,1164,0);
   }
   else if(doorplace == "C-4-SC1-back2")
   {
      _root.changecourse("StarIn","C-4",1036,0,1036,0);
   }
   else if(doorplace == "level1")
   {
      _root.changecourse("StarIn","level1",0,0,0,0);
   }
   else
   {
      _root.changecourse("StarIn","C-1",0,0,0,0);
   }
};

This is taken from a Flash game, where speed and efficiency is fairly important. 1: used in 1 place 2: used in quite a lot of places 3: the door mapping must have changed during development...

By Anonymous, 2018-11-10 09:51:41
if(userEndDate.getTime() != null
    && userEndDate.getTime() > today.getTime()
    && endDateFromRequest != null ? endDateFromRequest.getTime() !== userEndDate.getTime() : true){
            
            //some code
     }

for code lovers :D

By Unnamed, 2018-11-30 16:12:08
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
if (baza[mCurrentIndex] == Boolean.TRUE) {
            if (mCurrentIndex != baza.length-1) {
                up();
                nextQuestion();
            }

            if (mCurrentIndex == baza.length) {
                WypiszWynik();
            }

        }

so you have an array of booleans and you're comparing it to Boolean.TRUE why

By pain, 2017-10-31 21:58:54
#53 C++ +1
int chromosome::getScore()
{
    return this->getScore();
}
By Anonymous, 2015-11-05 15:41:39