public enum YesNoEnum
{
	Yes = 0,
	No = 1
}

I also like how they defined the enum values.

By Anonymous, 2018-05-19 19:33:44
// 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
int i=0;

                        for (i=0; i<msg.length;i++){

                            switch (i){

                                  case 0:

                                  case 1:

                                  case 2:

                                  case 3:

                                  case 4:

                                  case 5:

                                  case 6:

                                  case 7:

                                  case 8:

                                  case 9:

                                  case 10:

                                  case 11:

                                  case 18:

                                  case 19:

                                  case 26:

                                  case 27:

                                  case 34:

                                  case 35:

                                  case 42:

                                  case 43:

                                  case 50:

                                  case 51:

                                  case 52:

                                  case 53:

                                  case 54:

                                  case 55:

                                  case 58:

                                  case 59:

                                  case 62:

                                  case 63: log.debug("******** TRAZA-BEA: autenticacion ntlm. mensaje[" + i + "]: " + msg[i] + " SINSIGNO: " + (int)(msg[i] & 0x00ff) + "   " + new String(msg,i,1, "UTF-16LE")); break;

                                  case 12:

                                  case 14:

                                  case 16:

                                  case 20:

                                  case 22:

                                  case 24:

                                  case 28:

                                  case 30:

                                  case 32:

                                  case 36:

                                  case 38:

                                  case 40:

                                  case 44:

                                  case 46:

                                  case 48:

                                  case 56:

                                  case 60:log.debug("******** TRAZA-BEA: autenticacion ntlm. mensaje[" + i + "]: " + msg[i] + " SINSIGNO: " + (int)(msg[i] & 0x00ff) + "   " + new String(msg,i,2, "UTF-16LE")); break;

                                  case 13:

                                  case 15:

                                  case 17:

                                  case 21:

                                  case 23:

                                  case 25:

                                  case 29:

                                  case 31:

                                  case 33:

                                  case 37:

                                  case 39:

                                  case 41:

                                  case 45:

                                  case 47:

                                  case 49:

                                  case 57:

Why not case 60? LOL

By Pabs, 2017-12-26 14:03:33
protected void EnableEditButtons(bool Value)
{
    if (Value == false)
    {
        buttonAdd.Disabled = true;
        buttonDelete.Disabled = true;
    }
    else
    {
        buttonAdd.Disabled = false;
        buttonDelete.Disabled = false;
    }
}

// ...

if (IsEditable(ID))
    EnableEditButtons(true);
else
    EnableEditButtons(false);

I found this old code in an app I was updating for a client a number of years back. It was so good I documented it on my own blog.

By Jon Hartmann, 2017-12-12 17:09:54
file = fopen(argv[1], "r");

if (file == NULL){}
    exit(EXIT_FAILURE);

Those silly curly braces.

By Anonymous, 2017-12-14 05:47:47
zipped_file.extractall(f'{file_path}')
zipped_file.close()
By Anonymous, 2017-12-19 10:29:52
o.isInsured = function ()
{ return !!this.insured; }

Why don't be like normal people and use bool() cast?

By Anonymous, 2018-09-22 14:31:37
//count to 10
#include <iostream>
#include <string>

int main()
{
  int i = 0;
  
  beginning:
  if (i < 10) {
      std::cout << ++i << std::endl;
      goto beginning;
  }
  else goto end;

  end:
  return 0;
}
By Yoges, 2017-12-19 14:43:26
#35 HTML +57
<div id="header">
 <ul>
 <li id="current"><a href="index.php">Strona Główna</a></li>
 <li id="current"><a href="index.php?cmd=1">Aktualności</a></li>
 <li id="current"><a href="index.php?cmd=2">Strony Serwisu</a></li>
 <li id="current"><a href="index.php?cmd=10">Artykuly</a></li>
 <li id="current"><a href="index.php?cmd=3">Linki</a></li>
 <li id="current"><a href="index.php?cmd=4">Księga Gości</a></li>
 <li id="current"><a href="index.php?cmd=5">Newsletter</a></li>
 <li id="current"><a href="index.php?cmd=6">Użytkownicy</a></li>
 <li id="current"><a href="index.php?cmd=8">Menu</a></li>
 <li id="current"><a href="index.php?cmd=12">Bannery</a></li>
 <li id="current"><a href="index.php?cmd=11">Pliki</a></li>
 <li id="current"><a href="index.php?cmd=7">Forum</a></li>
 <li id="current"><a href="index.php?cmd=13">Ban</a></li>
 <li id="current"><a href="index.php?cmd=9">Konfiguracja</a></li>
</ul></div>
By Sobak, 2015-07-21 12:35:41
int length = 0;
for(int idx = 0; idx < a.length; i++) {
     length++;
}
System.out.println("length is : " + length);
By Slacki, 2015-07-22 14:25:02
def sho_est(request):
    if not request.user.is_superuser and not request.user.is_staff and not request.user.is_university:
        raise Http404
    data = ''
    if request.content_type == 'application/x-www-form-urlencoded' and request.method == 'POST':
        user_detail = request.POST.get('user_detail', None)
        if user_detail:
            if request.user.is_superuser or request.user.is_staff:
                credito = Credit.objects.get(pk=user_detail)
                fecha_apronacion = 'Pendiente'
                estado_firma = 'Pendiente'
                estado_cuota = 'Pendiente'
                if credito.created_at:
                    fecha_apronacion = credito.created_at.strftime('%Y-%m-%d')
                if credito.is_iou_signed:
                    estado_firma = 'Firmado'
                if credito.is_retainer_paid:
                    estado_cuota = 'Paga'
                reg_amr_due = """
                <tr style="border: 1px solid black; padding: 5px;">
                    <td style="border: 1px solid black; padding: 5px; text-align: right;">{period}</td>
                    <td style="border: 1px solid black; padding: 5px; text-align: right;">{due_amount}</td>
                    <td style="border: 1px solid black; padding: 5px; text-align: right;">{due_loan_amount}</td>
                    <td style="border: 1px solid black; padding: 5px; text-align: right;">
                    {due_tech_amount_due_surety_amount_due}</td>
                    <td style="border: 1px solid black; padding: 5px; text-align: right;">{due_interest_amount}</td>
                    <td style="border: 1px solid black; padding: 5px; text-align: right;">
                    {due_fines_arrears_amount_due_interest_arrears_amount}</td>
                    <td style="border: 1px solid black; padding: 5px; text-align: left;">{days_in_arrears}</td>
                    <td style="border: 1px solid black; padding: 5px; text-align: left;">{fullfilment_date}</td>
                    <td style="border: 1px solid black; padding: 5px; text-align: left;">{status}</td>
                  </tr>
                  """
                str_amr_due = ""
                dic_ver = {}

Fuck Yeah

By rootweiller, 2020-01-15 04:09:48
final boolean True = true;   
final boolean False = false;
//why

:v

By Memz, 2019-12-31 03:25:05
#29 PHP +54
<?php 
foreach (array_keys($values['services']) as $serviceId) {
    $service = $this->_em->find('\cut\Entity\Service', $serviceId);

    //\Doctrine\Common\Util\Debug::print_r($service); exit();
    //$reservation->addService($this->_em->find('\cut\Entity\Service', $serviceId));
    $this->view->serviceDeposits[$serviceId] = $service->getDeposit();
}
# checkign if clinic want's bill
$notifications = array();
$reservationServices = array();
foreach (array_keys($values['services']) as $serviceId) {
    $reservationServices[$serviceId] = new \cut\Entity\ReservationService();
    $service                         = $this->_em->find('\cut\Entity\Service', $serviceId);
    //\Doctrine\Common\Util\Debug::print_r($service); exit();
    $reservationServices[$serviceId]->setService($service);
    $reservationServices[$serviceId]->setReservation($reservation);
    $reservationServices[$serviceId]->setPatient($this->_helper->LoggedUser());

    switch ($service->getDeposit()) {
        case 'yes':
            $reservationServices[$serviceId]->setBillStatus(\cut\Entity\ReservationService::BILL_STATUS_NOT_PAID);
            break;
        default:
            $reservationServices[$serviceId]->setBillStatus(\cut\Entity\ReservationService::BILL_STATUS_NOT_WANTED);
    }

    $this->view->serviceDeposits[$serviceId] = $service->getDeposit();
}
By Anonymous, 2015-07-20 21:12:05
// GetModelStruct get value's model struct, relationships based on struct and tag definition
func (scope *Scope) GetModelStruct() *ModelStruct {
	var modelStruct ModelStruct
	// Scope value can't be nil
	if scope.Value == nil {
		return &modelStruct
	}

	reflectType := reflect.ValueOf(scope.Value).Type()
	for reflectType.Kind() == reflect.Slice || reflectType.Kind() == reflect.Ptr {
		reflectType = reflectType.Elem()
	}

	// Scope value need to be a struct
	if reflectType.Kind() != reflect.Struct {
		return &modelStruct
	}

	// Get Cached model struct
	isSingularTable := false
	if scope.db != nil && scope.db.parent != nil {
		scope.db.parent.RLock()
		isSingularTable = scope.db.parent.singularTable
		scope.db.parent.RUnlock()
	}

	hashKey := struct {
		singularTable bool
		reflectType   reflect.Type
	}{isSingularTable, reflectType}
	if value, ok := modelStructsMap.Load(hashKey); ok && value != nil {
		return value.(*ModelStruct)
	}

	modelStruct.ModelType = reflectType

	// Get all fields
	for i := 0; i < reflectType.NumField(); i++ {
		if fieldStruct := reflectType.Field(i); ast.IsExported(fieldStruct.Name) {
			field := &StructField{
				Struct:      fieldStruct,
				Name:        fieldStruct.Name,
				Names:       []string{fieldStruct.Name},
				Tag:         fieldStruct.Tag,
				TagSettings: parseTagSetting(fieldStruct.Tag),
			}

			// is ignored field
			if _, ok := field.TagSettingsGet("-"); ok {
				field.IsIgnored = true
			} else {
				if _, ok := field.TagSettingsGet("PRIMARY_KEY"); ok {
					field.IsPrimaryKey = true
					modelStruct.PrimaryFields = append(modelStruct.PrimaryFields, field)
				}

				if _, ok := field.TagSettingsGet("DEFAULT"); ok && !field.IsPrimaryKey {
					field.HasDefaultValue = true
				}

				if _, ok := field.TagSettingsGet("AUTO_INCREMENT"); ok && !field.IsPrimaryKey {
					field.HasDefaultValue = true
				}

				indirectType := fieldStruct.Type
				for indirectType.Kind() == reflect.Ptr {
					indirectType = indirectType.Elem()
				}

				fieldValue := reflect.New(indirectType).Interface()
				if _, isScanner := fieldValue.(sql.Scanner); isScanner {
					// is scanner
					field.IsScanner, field.IsNormal = true, true
					if indirectType.Kind() == reflect.Struct {
						for i := 0; i < indirectType.NumField(); i++ {
							for key, value := range parseTagSetting(indirectType.Field(i).Tag) {
								if _, ok := field.TagSettingsGet(key); !ok {
									field.TagSettingsSet(key, value)
								}
							}
						}
					}
				} else if _, isTime := fieldValue.(*time.Time); isTime {
					// is time
					field.IsNormal = true
				} else if _, ok := field.TagSettingsGet("EMBEDDED"); ok || fieldStruct.Anonymous {
					// is embedded struct
					for _, subField := range scope.New(fieldValue).GetModelStruct().StructFields {
						subField = subField.clone()
						subField.Names = append([]string{fieldStruct.Name}, subField.Names...)
						if prefix, ok := field.TagSettingsGet("EMBEDDED_PREFIX"); ok {
							subField.DBName = prefix + subField.DBName
						}

						if subField.IsPrimaryKey {
							if _, ok := subField.TagSettingsGet("PRIMARY_KEY"); ok {
								modelStruct.PrimaryFields = append(modelStruct.PrimaryFields, subField)
							} else {
								subField.IsPrimaryKey = false
							}
						}

						if subField.Relationship != nil && subField.Relationship.JoinTableHandler != nil {
							if joinTableHandler, ok := subField.Relationship.JoinTableHandler.(*JoinTableHandler); ok {
								newJoinTableHandler := &JoinTableHandler{}
								newJoinTableHandler.Setup(subField.Relationship, joinTableHandler.TableName, reflectType, joinTableHandler.Destination.ModelType)
								subField.Relationship.JoinTableHandler = newJoinTableHandler
							}
						}

						modelStruct.StructFields = append(modelStruct.StructFields, subField)
					}
					continue
				} else {
					// build relationships
					switch indirectType.Kind() {
					case reflect.Slice:
						defer func(field *StructField) {
							var (
								relationship           = &Relationship{}
								toScope                = scope.New(reflect.New(field.Struct.Type).Interface())
								foreignKeys            []string
								associationForeignKeys []string
								elemType               = field.Struct.Type
							)

							if foreignKey, _ := field.TagSettingsGet("FOREIGNKEY"); foreignKey != "" {
								foreignKeys = strings.Split(foreignKey, ",")
							}

							if foreignKey, _ := field.TagSettingsGet("ASSOCIATION_FOREIGNKEY"); foreignKey != "" {
								associationForeignKeys = strings.Split(foreignKey, ",")
							} else if foreignKey, _ := field.TagSettingsGet("ASSOCIATIONFOREIGNKEY"); foreignKey != "" {
								associationForeignKeys = strings.Split(foreignKey, ",")
							}

							for elemType.Kind() == reflect.Slice || elemType.Kind() == reflect.Ptr {
								elemType = elemType.Elem()
							}

							if elemType.Kind() == reflect.Struct {
								if many2many, _ := field.TagSettingsGet("MANY2MANY"); many2many != "" {
									relationship.Kind = "many_to_many"

									{ // Foreign Keys for Source
										joinTableDBNames := []string{}

										if foreignKey, _ := field.TagSettingsGet("JOINTABLE_FOREIGNKEY"); foreignKey != "" {
											joinTableDBNames = strings.Split(foreignKey, ",")
										}

										// if no foreign keys defined with tag
										if len(foreignKeys) == 0 {
											for _, field := range modelStruct.PrimaryFields {
												foreignKeys = append(foreignKeys, field.DBName)
											}
										}

										for idx, foreignKey := range foreignKeys {
											if foreignField := getForeignField(foreignKey, modelStruct.StructFields); foreignField != nil {
												// source foreign keys (db names)
												relationship.ForeignFieldNames = append(relationship.ForeignFieldNames, foreignField.DBName)

												// setup join table foreign keys for source
												if len(joinTableDBNames) > idx {
													// if defined join table's foreign key
													relationship.ForeignDBNames = append(relationship.ForeignDBNames, joinTableDBNames[idx])
												} else {
													defaultJointableForeignKey := ToColumnName(reflectType.Name()) + "_" + foreignField.DBName
													relationship.ForeignDBNames = append(relationship.ForeignDBNames, defaultJointableForeignKey)
												}
											}
										}
									}

									{ // Foreign Keys for Association (Destination)
										associationJoinTableDBNames := []string{}

										if foreignKey, _ := field.TagSettingsGet("ASSOCIATION_JOINTABLE_FOREIGNKEY"); foreignKey != "" {
											associationJoinTableDBNames = strings.Split(foreignKey, ",")
										}

										// if no association foreign keys defined with tag
										if len(associationForeignKeys) == 0 {
											for _, field := range toScope.PrimaryFields() {
												associationForeignKeys = append(associationForeignKeys, field.DBName)
											}
										}

										for idx, name := range associationForeignKeys {
											if field, ok := toScope.FieldByName(name); ok {
												// association foreign keys (db names)
												relationship.AssociationForeignFieldNames = append(relationship.AssociationForeignFieldNames, field.DBName)

												// setup join table foreign keys for association
												if len(associationJoinTableDBNames) > idx {
													relationship.AssociationForeignDBNames = append(relationship.AssociationForeignDBNames, associationJoinTableDBNames[idx])
												} else {
													// join table foreign keys for association
													joinTableDBName := ToColumnName(elemType.Name()) + "_" + field.DBName
													relationship.AssociationForeignDBNames = append(relationship.AssociationForeignDBNames, joinTableDBName)
												}
											}
										}
									}

									joinTableHandler := JoinTableHandler{}
									joinTableHandler.Setup(relationship, many2many, reflectType, elemType)
									relationship.JoinTableHandler = &joinTableHandler
									field.Relationship = relationship
								} else {
									// User has many comments, associationType is User, comment use UserID as foreign key
									var associationType = reflectType.Name()
									var toFields = toScope.GetStructFields()
									relationship.Kind = "has_many"

									if polymorphic, _ := field.TagSettingsGet("POLYMORPHIC"); polymorphic != "" {
										// Dog has many toys, tag polymorphic is Owner, then associationType is Owner
										// Toy use OwnerID, OwnerType ('dogs') as foreign key
										if polymorphicType := getForeignField(polymorphic+"Type", toFields); polymorphicType != nil {
											associationType = polymorphic
											relationship.PolymorphicType = polymorphicType.Name
											relationship.PolymorphicDBName = polymorphicType.DBName
											// if Dog has multiple set of toys set name of the set (instead of default 'dogs')
											if value, ok := field.TagSettingsGet("POLYMORPHIC_VALUE"); ok {
												relationship.PolymorphicValue = value
											} else {
												relationship.PolymorphicValue = scope.TableName()
											}
											polymorphicType.IsForeignKey = true
										}
									}

									// if no foreign keys defined with tag
									if len(foreignKeys) == 0 {
										// if no association foreign keys defined with tag
										if len(associationForeignKeys) == 0 {
											for _, field := range modelStruct.PrimaryFields {
												foreignKeys = append(foreignKeys, associationType+field.Name)
												associationForeignKeys = append(associationForeignKeys, field.Name)
											}
										} else {
											// generate foreign keys from defined association foreign keys
											for _, scopeFieldName := range associationForeignKeys {
												if foreignField := getForeignField(scopeFieldName, modelStruct.StructFields); foreignField != nil {
													foreignKeys = append(foreignKeys, associationType+foreignField.Name)
													associationForeignKeys = append(associationForeignKeys, foreignField.Name)
												}
											}
										}
									} else {
										// generate association foreign keys from foreign keys
										if len(associationForeignKeys) == 0 {
											for _, foreignKey := range foreignKeys {
												if strings.HasPrefix(foreignKey, associationType) {
													associationForeignKey := strings.TrimPrefix(foreignKey, associationType)
													if foreignField := getForeignField(associationForeignKey, modelStruct.StructFields); foreignField != nil {
														associationForeignKeys = append(associationForeignKeys, associationForeignKey)
													}
												}
											}
											if len(associationForeignKeys) == 0 && len(foreignKeys) == 1 {
												associationForeignKeys = []string{scope.PrimaryKey()}
											}
										} else if len(foreignKeys) != len(associationForeignKeys) {
											scope.Err(errors.New("invalid foreign keys, should have same length"))
											return
										}
									}

									for idx, foreignKey := range foreignKeys {
										if foreignField := getForeignField(foreignKey, toFields); foreignField != nil {
											if associationField := getForeignField(associationForeignKeys[idx], modelStruct.StructFields); associationField != nil {
												// source foreign keys
												foreignField.IsForeignKey = true
												relationship.AssociationForeignFieldNames = append(relationship.AssociationForeignFieldNames, associationField.Name)
												relationship.AssociationForeignDBNames = append(relationship.AssociationForeignDBNames, associationField.DBName)

												// association foreign keys
												relationship.ForeignFieldNames = append(relationship.ForeignFieldNames, foreignField.Name)
												relationship.ForeignDBNames = append(relationship.ForeignDBNames, foreignField.DBName)
											}
										}
									}

									if len(relationship.ForeignFieldNames) != 0 {
										field.Relationship = relationship
									}
								}
							} else {
								field.IsNormal = true
							}
						}(field)
					case reflect.Struct:
						defer func(field *StructField) {
							var (
								// user has one profile, associationType is User, profile use UserID as foreign key
								// user belongs to profile, associationType is Profile, user use ProfileID as foreign key
								associationType           = reflectType.Name()
								relationship              = &Relationship{}
								toScope                   = scope.New(reflect.New(field.Struct.Type).Interface())
								toFields                  = toScope.GetStructFields()
								tagForeignKeys            []string
								tagAssociationForeignKeys []string
							)

							if foreignKey, _ := field.TagSettingsGet("FOREIGNKEY"); foreignKey != "" {
								tagForeignKeys = strings.Split(foreignKey, ",")
							}

							if foreignKey, _ := field.TagSettingsGet("ASSOCIATION_FOREIGNKEY"); foreignKey != "" {
								tagAssociationForeignKeys = strings.Split(foreignKey, ",")
							} else if foreignKey, _ := field.TagSettingsGet("ASSOCIATIONFOREIGNKEY"); foreignKey != "" {
								tagAssociationForeignKeys = strings.Split(foreignKey, ",")
							}

							if polymorphic, _ := field.TagSettingsGet("POLYMORPHIC"); polymorphic != "" {
								// Cat has one toy, tag polymorphic is Owner, then associationType is Owner
								// Toy use OwnerID, OwnerType ('cats') as foreign key
								if polymorphicType := getForeignField(polymorphic+"Type", toFields); polymorphicType != nil {
									associationType = polymorphic
									relationship.PolymorphicType = polymorphicType.Name
									relationship.PolymorphicDBName = polymorphicType.DBName
									// if Cat has several different types of toys set name for each (instead of default 'cats')
									if value, ok := field.TagSettingsGet("POLYMORPHIC_VALUE"); ok {
										relationship.PolymorphicValue = value
									} else {
										relationship.PolymorphicValue = scope.TableName()
									}
									polymorphicType.IsForeignKey = true
								}
							}

							// Has One
							{
								var foreignKeys = tagForeignKeys
								var associationForeignKeys = tagAssociationForeignKeys
								// if no foreign keys defined with tag
								if len(foreignKeys) == 0 {
									// if no association foreign keys defined with tag
									if len(associationForeignKeys) == 0 {
										for _, primaryField := range modelStruct.PrimaryFields {
											foreignKeys = append(foreignKeys, associationType+primaryField.Name)
											associationForeignKeys = append(associationForeignKeys, primaryField.Name)
										}
									} else {
										// generate foreign keys form association foreign keys
										for _, associationForeignKey := range tagAssociationForeignKeys {
											if foreignField := getForeignField(associationForeignKey, modelStruct.StructFields); foreignField != nil {
												foreignKeys = append(foreignKeys, associationType+foreignField.Name)
												associationForeignKeys = append(associationForeignKeys, foreignField.Name)
											}
										}
									}
								} else {
									// generate association foreign keys from foreign keys
									if len(associationForeignKeys) == 0 {
										for _, foreignKey := range foreignKeys {
											if strings.HasPrefix(foreignKey, associationType) {
												associationForeignKey := strings.TrimPrefix(foreignKey, associationType)
												if foreignField := getForeignField(associationForeignKey, modelStruct.StructFields); foreignField != nil {
													associationForeignKeys = append(associationForeignKeys, associationForeignKey)
												}
											}
										}
										if len(associationForeignKeys) == 0 && len(foreignKeys) == 1 {
											associationForeignKeys = []string{scope.PrimaryKey()}
										}
									} else if len(foreignKeys) != len(associationForeignKeys) {
										scope.Err(errors.New("invalid foreign keys, should have same length"))
										return
									}
								}

								for idx, foreignKey := range foreignKeys {
									if foreignField := getForeignField(foreignKey, toFields); foreignField != nil {
										if scopeField := getForeignField(associationForeignKeys[idx], modelStruct.StructFields); scopeField != nil {
											foreignField.IsForeignKey = true
											// source foreign keys
											relationship.AssociationForeignFieldNames = append(relationship.AssociationForeignFieldNames, scopeField.Name)
											relationship.AssociationForeignDBNames = append(relationship.AssociationForeignDBNames, scopeField.DBName)

											// association foreign keys
											relationship.ForeignFieldNames = append(relationship.ForeignFieldNames, foreignField.Name)
											relationship.ForeignDBNames = append(relationship.ForeignDBNames, foreignField.DBName)
										}
									}
								}
							}

							if len(relationship.ForeignFieldNames) != 0 {
								relationship.Kind = "has_one"
								field.Relationship = relationship
							} else {
								var foreignKeys = tagForeignKeys
								var associationForeignKeys = tagAssociationForeignKeys

								if len(foreignKeys) == 0 {
									// generate foreign keys & association foreign keys
									if len(associationForeignKeys) == 0 {
										for _, primaryField := range toScope.PrimaryFields() {
											foreignKeys = append(foreignKeys, field.Name+primaryField.Name)
											associationForeignKeys = append(associationForeignKeys, primaryField.Name)
										}
									} else {
										// generate foreign keys with association foreign keys
										for _, associationForeignKey := range associationForeignKeys {
											if foreignField := getForeignField(associationForeignKey, toFields); foreignField != nil {
												foreignKeys = append(foreignKeys, field.Name+foreignField.Name)
												associationForeignKeys = append(associationForeignKeys, foreignField.Name)
											}
										}
									}
								} else {
									// generate foreign keys & association foreign keys
									if len(associationForeignKeys) == 0 {
										for _, foreignKey := range foreignKeys {
											if strings.HasPrefix(foreignKey, field.Name) {
												associationForeignKey := strings.TrimPrefix(foreignKey, field.Name)
												if foreignField := getForeignField(associationForeignKey, toFields); foreignField != nil {
													associationForeignKeys = append(associationForeignKeys, associationForeignKey)
												}
											}
										}
										if len(associationForeignKeys) == 0 && len(foreignKeys) == 1 {
											associationForeignKeys = []string{toScope.PrimaryKey()}
										}
									} else if len(foreignKeys) != len(associationForeignKeys) {
										scope.Err(errors.New("invalid foreign keys, should have same length"))
										return
									}
								}

								for idx, foreignKey := range foreignKeys {
									if foreignField := getForeignField(foreignKey, modelStruct.StructFields); foreignField != nil {
										if associationField := getForeignField(associationForeignKeys[idx], toFields); associationField != nil {
											foreignField.IsForeignKey = true

											// association foreign keys
											relationship.AssociationForeignFieldNames = append(relationship.AssociationForeignFieldNames, associationField.Name)
											relationship.AssociationForeignDBNames = append(relationship.AssociationForeignDBNames, associationField.DBName)

											// source foreign keys
											relationship.ForeignFieldNames = append(relationship.ForeignFieldNames, foreignField.Name)
											relationship.ForeignDBNames = append(relationship.ForeignDBNames, foreignField.DBName)
										}
									}
								}

								if len(relationship.ForeignFieldNames) != 0 {
									relationship.Kind = "belongs_to"
									field.Relationship = relationship
								}
							}
						}(field)
					default:
						field.IsNormal = true
					}
				}
			}

			// Even it is ignored, also possible to decode db value into the field
			if value, ok := field.TagSettingsGet("COLUMN"); ok {
				field.DBName = value
			} else {
				field.DBName = ToColumnName(fieldStruct.Name)
			}

			modelStruct.StructFields = append(modelStruct.StructFields, field)
		}
	}

	if len(modelStruct.PrimaryFields) == 0 {
		if field := getForeignField("id", modelStruct.StructFields); field != nil {
			field.IsPrimaryKey = true
			modelStruct.PrimaryFields = append(modelStruct.PrimaryFields, field)
		}
	}

	modelStructsMap.Store(hashKey, &modelStruct)

	return &modelStruct
}
By Anonymous, 2019-06-12 20:07:03
<?php

if ($_GET['csrfstopper'] !== 1){
    exit();
}

Please don't judge my friend trying to stop CSRF Attacks he's still learning.

By Lunorian, 2017-12-14 04:37:45