- 1
- 2
- 3
- 4
private function onClick(e:MouseEvent):void
{
dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false))
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−99
private function onClick(e:MouseEvent):void
{
dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false))
}
Еще один кусочек очень полезного кода. (this для этого обработчика - MovieClip).
+20
void __fastcall TfРѕrm1::SpeedButton1Click(TobjРµct *Sender)
{
SpeedButton1->Enabled=false;
SpeedButton1->Caption=Edit1->Text;
if(Edit1->Text=="X")
Edit1->Text="0";
else
Edit1->Text="X";
if(SpeedButton1->Caption=="X" && SpeedButton2->Caption=="X" && SpeedButton3->Caption=="X" ||
SpeedButton4->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton6->Caption=="X" ||
SpeedButton7->Caption=="X" && SpeedButton8->Caption=="X" && SpeedButton9->Caption=="X" ||
SpeedButton1->Caption=="X" && SpeedButton4->Caption=="X" && SpeedButton7->Caption=="X" ||
SpeedButton2->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton8->Caption=="X" ||
SpeedButton3->Caption=="X" && SpeedButton6->Caption=="X" && SpeedButton9->Caption=="X" ||
SpeedButton1->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton9->Caption=="X" ||
SpeedButton3->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton7->Caption=="X")
ShowMessage("Ea?a caeii?aia, e?anoeee auea?aee");
else
if(SpeedButton1->Caption=="0" && SpeedButton2->Caption=="0" && SpeedButton3->Caption=="0" ||
SpeedButton4->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton6->Caption=="0" ||
SpeedButton7->Caption=="0" && SpeedButton8->Caption=="0" && SpeedButton9->Caption=="0" ||
SpeedButton1->Caption=="0" && SpeedButton4->Caption=="0" && SpeedButton7->Caption=="0" ||
SpeedButton2->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton8->Caption=="0" ||
SpeedButton3->Caption=="0" && SpeedButton6->Caption=="0" && SpeedButton9->Caption=="0" ||
SpeedButton1->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton9->Caption=="0" ||
SpeedButton3->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton7->Caption=="0")
ShowMessage("Ea?a caeii?aia, iieeee auea?aee");
}
+133
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// ...skipped...
});
</script>
<!-- end script vert menu -->
<!-- spoiler -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"> </script>
<script type="text/javascript">
$(document).ready(function(){
// ...skipped...
});
</script>
<!-- spoiler -->
<!-- up-->
<script language="JavaScript" type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script><!--up-->
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'></script>
<script type="text/javascript" src="ajax.js"></script>
<!-- gallery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
jQuery в организме не хватает?..
−122
if (activeObject && (((activeObject is LevelObjectBirdBlack) || (activeObject is LevelObjectBirdOrange)) || (activeObject is LevelObjectBirdOrange)) && (!(activeObject as LevelObjectBird).specialPowerUsed || activeObject.getSpecialAnimationProgress() >= 0 ) )
{...}
primerno tak vyglyadit angry birds from inside
+18
template <class TBitMap, int MMCROffset>
class TControllerMemoryMappedRegister: public TBaseControllerMemoryMappedRegister<MMCROffset>
{
public:
static void set(TBitMap::E Bit) { setBit(Bit); }
static void reset(TBitMap::E Bit) { resetBit(Bit); }
};
+136
revision = String.Format("{0}{1:d2}{2:d2}",
DateTime.Now.Year.ToString().Substring(2),
DateTime.Today.Month,
DateTime.Today.Day);
видно автор хотел сделать
revision = DateTime.Today.ToString("yyMMdd");
http://www.codeproject.com/Articles/272551/Custom-Assembly-Versioning-with-VS-2010-and-MSBUIL
+15
#include <iostream>
#include <cxxabi.h>
#include <typeinfo>
int main(void)
{
uint8_t i = 63;
int status;
std::cout << i << std::endl;
char *realname = abi::__cxa_demangle(typeid(i).name(), 0, 0, &status);
std::cout << "Real type of uint8_t is: " << realname << std::endl;
delete (realname);
std::cout << (unsigned int)i << std::endl;
return 0;
}
...нативный 8bit-ый беззнаковый int.
+140
int next_id() {
static int id = 0;
__sync_add_and_fetch(&id, 1);
return id;
}
"Атомарная" раздача айдишек.
−94
#!/usr/local/bin/cpython
回答 = 读入('你认为中文程式语言有存在价值吗 ? (有/没有)')
如 回答 == '有':
写 '好吧, 让我们一起努力!'
不然 回答 == '没有':
写 '好吧,中文并没有作为程式语言的价值.'
否则:
写 '请认真考虑后再回答.'
http://ru.wikipedia.org/wiki/ChinesePython
Сопроваждай, пробуй!
+137
static /*public*/ string GenerateRandomJpegName()
{
return GenerateRandomString() + ".jpg";
}
static string GenerateRandomString()
{
bool UseSigns = true;
bool UseUpperLetters = true;
bool UseLetters = true;
int Length;
NewLabel:
try
{
Length = new Random(DateTime.Now.Millisecond - DateTime.Now.Second + new Random(DateTime.Now.Millisecond).Next(0, 100) / new Random(DateTime.Now.Millisecond - DateTime.Now.Second).Next(0, 10)).Next(0, 100);
}
catch { goto NewLabel; }
string result = "C:/";
try
{
int Seed = 0;
char[] letters = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
char[] signs = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
List<char> keyWords = new List<char>();
List<char> upperLetters = new List<char>();
foreach (char c in letters)
upperLetters.Add(Convert.ToChar(c.ToString().ToUpper()));
if (UseLetters)
foreach (char c in letters)
keyWords.Add(c);
if (UseSigns)
foreach (char c in signs)
keyWords.Add(c);
if (UseUpperLetters)
foreach (char c in upperLetters)
keyWords.Add(c);
int MaxValue = keyWords.Count;
for (int i = 0; i <= Length; i++)
{
try
{
Random mainrand = new Random(Seed);
char RandChar = keyWords[mainrand.Next(0, MaxValue)];
result += RandChar;
Seed += DateTime.Now.Millisecond + Seed - new Random().Next(10) + new Random(DateTime.Now.Millisecond + 800 * 989 / 3).Next(10);
}
catch { continue; }
}
}
catch { }
return result;
}
Вместо одного вызова Path.GetRandomFileName