- 1
typedef boost::shared_ptr<LPDIRECT3D9> Direct3dShared;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+10
typedef boost::shared_ptr<LPDIRECT3D9> Direct3dShared;
Те кто знают, что такое в гейдеве LPDIRECT3D9 и IDirect3D9 - поймут.
Думаю сегодня даже не нужно писать с какого это сайта.
+133
var firstLocation = new Tuple<Point, Point>(new Point(12, 444 - 38), new Point(30, 446 - 38));
var secondLocation = new Tuple<Point, Point>(new Point(12, 464 - 38), new Point(30, 464 - 38));
var thirdLocation = new Tuple<Point, Point>(new Point(12, 486 - 38), new Point(30, 484 - 38));
var first = new Tuple<Control, Control>(chbDimaGaugeNewContractPS, lblDimaGaugeNewContractPS);
var second = new Tuple<Control, Control>(chbDimaGaugeNewContractIBanking, lblDimaGaugeNewContractIBanking);
var third = new Tuple<Control, Control>(chbDimaGaugeNewContractActivePS, lblDimaGaugeNewContractActivePS);
var controls = new List<Tuple<Control, Control>> { first, second, third };
var points = new List<Tuple<Point, Point>> { firstLocation, secondLocation, thirdLocation };
int i = 0;
foreach (var t in controls.Where(x => !x.Item1.Enabled))
{
t.Item1.Location = points[i].Item1;
t.Item2.Location = points[i].Item2;
i++;
}
кортежи в .NET - хорошо или плохо?
+131
http://bolknote.ru/files/dogfight/
Возбуждает
−152
protected function get_resource_getter(xml:XML,name:String):Function {
try {
var getter:Function = this["get_"+name+"_xml"] as Function;
return function():int{ return getter(xml)};
} catch (e:*) {}
if(xml.attribute(name).length()==0){
return null;
}
return function():int{ return get_resource_xml(xml,name)};
}
Задача стояла предельно простая: получить количество некоторого игрового ресурса.
Автор подошел к решению неординарно.
+74
if (!(bundle == null))
+129
#region Work with massive slovo
public string sFileNameMassiveSlovar = "";
public bool flChangeSlovo = false;
public int nCountSavedSlovo { get; private set; }
public int nCountAllSlovo { get; private set; }
public int nCountAddSlovo { get; private set; }
public void ClearMassiveSlovo()
{
slovo = slovo.Select(n => (byte)0).ToArray();
}
public int GetCountAllSlovo()
{
int npock = nLengthSlovo;
return slovo.Where((n, index) => index % npock == 0 && n != 0).Count();
}
public bool WriteMassiveSlovo()
{
bool res = false;
FileStream fs = null;
try
{
fs = File.Open(sFileNameMassiveSlovar, FileMode.Create, FileAccess.Write);
if (fs != null)
{
fs.Write(slovo, 0, nSizeMassiveSlova);
}
res = true;
}
catch (Exception e1)
{
res = false;
System.Windows.Forms.MessageBox.Show(e1.Message);
}
finally
{
if (fs != null) fs.Close();
}
return res;
}
#endregion
+157
window.SYSTEM_LOCALE ='ru';
if ((/ru/i).test(window.SYSTEM_LOCALE)) {
window.SYSTEM_LOCALE = "ru";
} else if ((/en/i).test(window.SYSTEM_LOCALE)) {
window.SYSTEM_LOCALE = "en";
} else if ((/uk|ua/i).test(window.SYSTEM_LOCALE)) {
window.SYSTEM_LOCALE = "uk";
};
wtf?
−106
Всякий раз наводя курсор на кнопку "Пуск" в Windows 7 вы видели как она менялась.
И вы наверно думали: а как реолизовать такой эффект в VB6? Давайте попробуем
Код:
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture("C:Безымянный.bmp") ' при наведении курсора на имейдж в него загрузится картинка
End Sub
Ну теперь запускаем. Чтож мы видим? Навели курсор - картинка в имейдже измнилась.
Но ведь она должна изменятся обратно при отведении курсора. Но почему-то MuseMove этого не поддерживает.
Тогда придётся втянуть в это дело форму. Наведением курсора на форму мы будем имитировать отведение курсора от имейджа.
Вот код вместе с первым примером.
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture("C:Безымянный1.bmp")' при наведении курсора на форму в имейдж загрузится картинка которая была раньше
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture("C:Безымянный.bmp")' при наведении курсора на имейдж в него загрузится картинка
End Sub
Еще пара таких кодов, и мне начнет нравиться Борис М.
А че, интересный парень.
+105
if (App.TimerClock != null)
{
App.TimerClock.Enabled = false;
App.TimerClock.Close();
App.TimerClock.Dispose();
App.TimerClock = null;
}
+109
static void Main(string[] args)
{
Console.WriteLine("Как желаете заполнить?");
Console.WriteLine("Цифра 1 = в столбик, цифра 2 = в строчку");
int valMethod = Convert.ToInt32(Console.ReadLine());
Console.Clear();
Console.SetCursorPosition(1, 0);
for (int index = 1; index != 22; index++)
{
Console.CursorLeft = 1;
Console.WriteLine('║');
if (index < 21)
{
Console.CursorLeft = 19;
Console.Write('║');
}
}
Console.SetCursorPosition(1, 0);
for (int index = 1; index != 62; index++)
Console.Write('═');
Console.SetCursorPosition(35, 1);
int valueRow = 0;
for (int i = 0; i < 4; i++)
{
for (int index = 1; index != 20; index++)
{
Console.SetCursorPosition(28 + valueRow, 1 + index);
Console.WriteLine('║');
}
valueRow += 8;
}
for (int index = 1; index != 20; index++)
{
Console.SetCursorPosition(29 + valueRow, 0 + index);
Console.WriteLine('║');
}
Console.SetCursorPosition(20, 2);
for (int index = 1; index != 43; index++)
Console.Write('═');
int value = 4;
for (int i = 0; i < 9; i++)
{
Console.SetCursorPosition(1, value);
for (int index = 1; index != 62; index++)
Console.Write('═');
value += 2;
}
Console.SetCursorPosition(6, 2);
Console.WriteLine("Спортсмен");
Console.SetCursorPosition(25, 1);
Console.WriteLine("Вид спорта");
int value1 = 5;
for (int i = 1; i < 9; i++)
{
Console.SetCursorPosition(6, value1);
Console.WriteLine("{0}", i);
value1 += 2;
}
int value2 = 2;
for (int i = 1; i < 6; i++)
{
Console.SetCursorPosition(22 + value2, 3);
Console.Write("{0}", i);
value2 += 8;
}
Console.SetCursorPosition(1, 0);
Console.Write("╔");
Console.SetCursorPosition(61, 0);
Console.Write("╗");
Console.SetCursorPosition(1, 20);
Console.Write("╚");
Console.SetCursorPosition(61, 20);
Console.Write("╝");
...
Мы так любим магические числа...