- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
my @args = (
one => 1,
two => 2,
three => 3,
);
croak(q/'hashes' only/) if (@args & 1);
my $args = join ';', map { join '=', @args[$_, $_ + 1] } grep { !($_ & 1) } 0 .. $#args;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−159
my @args = (
one => 1,
two => 2,
three => 3,
);
croak(q/'hashes' only/) if (@args & 1);
my $args = join ';', map { join '=', @args[$_, $_ + 1] } grep { !($_ & 1) } 0 .. $#args;
Осилил, блин...
+159
$(function () {
$('#Who').click(whoAre);
});
function whoAre() {
var who = document.getElementById('whoAreyou');
var value = who.style.display;
var aspnetRoles = document.getElementById('aspnetRoles');
if (value == "none") {
who.style.display = "block";
aspnetRoles[0].value = "Агент";
aspnetRoles[1].value = "Арендодатель";
aspnetRoles[0].text = "Агент";
aspnetRoles[1].text = "Арендодатель";
} else {
who.style.display = "none";
aspnetRoles[0].value = "Moderator";
aspnetRoles[1].value = "Moderator";
aspnetRoles[0].text = "Moderator";
aspnetRoles[1].text = "Moderator";
}
}
меняет элементы, option
+135
try
{
HttpWebRequest httpWebReq = (HttpWebRequest)WebRequest.Create(this.OURURL);
httpWebReq.Timeout = 2000;
httpWebReq.Method = "POST";
string Response = ResponseStreamReader.ReadToEnd();
// bla-bla-bla ...
httpWebReq.GetResponse().Close();
httpWebReq = null;
Response = null;
}
+137
readonly string NEWLINE = "\r\n";
+134
class UnathorizedDevice : ArgumentException { public UnathorizedDevice() : base() { } }
class LocalException : ArgumentException { public LocalException(string message) : base(message) { } }
Говно или не говно? Мне кажется первое
+133
rem Check if Windows XP or Windows 7
rem XP: C:\Documents and Settings (or language specific folder)
rem 7: C:\Users
set oprsystem=%appdata:~3,5%
if %oprsystem%==Users (
set ops=win7
) else (
set ops=winxp
)
Batch
http://members.ferrara.linux.it/freddy77/encfs.html
+128
ng-include="'views/partials/header.html'"
- class="navbar navbar-static-fixed-top nav"></div>
+ /*class="navbar navbar-static-fixed-top nav"*/></div>
<ui-view id="main" class="container" id="mainContainer"></ui-view>
GIT commit diff for Angular template
+57
#include "TrayIcon.h"
// ----------------------------------------------------------------------------
TrayIcon::TrayIcon(QObject* parent) : QSystemTrayIcon(parent),
INTERVAL(1000),
WIDTH_ICON(30), HEIGHT_ICON(30)
{
currentDate = QDate(0, 0, 0);
defaultIcon = QPixmap(WIDTH_ICON, HEIGHT_ICON);
defaultIcon.fill(Qt::black);
reminderIcon = QPixmap(WIDTH_ICON, HEIGHT_ICON);
reminderIcon.fill(Qt::yellow);
thousandthDayIcon = QPixmap(WIDTH_ICON, HEIGHT_ICON);
thousandthDayIcon.fill(Qt::green);
dialogBoxIsActive = false;
readSettings();
wasReminder = false;
wasCongratulation = false;
wasSetNewDate = false;
slotUpdateDate();
QMenu* contextMenu = new QMenu;
contextMenu->addAction("Set date of birth...",
this, SLOT(slotSetDateOfBirth()));
QAction* autorunAction = contextMenu->addAction("Autorun",
this, SLOT(slotSetAutorun(bool)));
autorunAction->setCheckable(true);
autorunAction->setChecked(autorun);
contextMenu->addSeparator();
contextMenu->addAction("About...", this, SLOT(slotAboutMyProgram()));
contextMenu->addSeparator();
contextMenu->addAction("Quit", qApp, SLOT(quit()));
setContextMenu(contextMenu);
QTimer* timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), SLOT(slotUpdateDate()));
timer->start(500);
}
// ----------------------------------------------------------------------------
void TrayIcon::slotUpdateDate()
{
if((currentDate != QDate::currentDate()) || wasSetNewDate)
{
currentDate = QDate::currentDate();
daysToThousandthDay
= INTERVAL - dateOfBirth.daysTo(currentDate) % INTERVAL;
wasCongratulation = false;
wasReminder = false;
wasSetNewDate = false;
if((daysToThousandthDay != INTERVAL) && (daysToThousandthDay != 1))
{
setIcon(QIcon(defaultIcon));
setToolTip("Until next thousandth day in " +
QString().number(daysToThousandthDay) + " days.");
}
else
{
if(daysToThousandthDay == 1)
{
if(!wasReminder)
reminderBeforeDay();
}
else
{
if(!wasCongratulation)
congratulation();
}
}
}
}
Описание конструктора и одного из методов класса иконки в системном трее из программы, которая должна оповещать пользователя о каждом тысячном дне его жизни. Написано на Qt.
Полная версия:
main: http://pastebin.com/DEKiMWdb
хедер класса иконки трея: http://pastebin.com/rN9NwBPB
.cpp класса иконки трея: http://pastebin.com/uuyf5uxX
хедер класса окна ввода даты рождения: http://pastebin.com/bmfAbFwg
.cpp класса окна ввода даты рождения: http://pastebin.com/3R8BaPFC
+118
if (operator instanceof TUOperatorStacker) {
dump.put("operator_type", "TUOperatorStacker");
} else if (operator instanceof TUOperatorDestacker) {
dump.put("operator_type", "TUOperatorDestacker");
} else if (operator instanceof TUOperatorTargetedStacker) {
dump.put("operator_type", "TUOperatorTargetedStacker");
} else if (operator instanceof TUOperatorTargetedDestacker) {
dump.put("operator_type", "TUOperatorTargetedDestacker");
}
<...>
String typeString = (String) dump.get("operator_type");
TUOperator operator = null;
if (typeString.equals("TUOperatorStacker")) {
operator = new TUOperatorStacker(simElement);
} else if (typeString.equals("TUOperatorDestacker")) {
operator = new TUOperatorDestacker(simElement);
} else if (typeString.equals("TUOperatorTargetedStacker")) {
operator = new TUOperatorTargetedStacker(simElement);
} else if (typeString.equals("TUOperatorTargetedDestacker")) {
operator = new TUOperatorTargetedDestacker(simElement);
}
+154
if (d_min < 0) {
// push out by normal * |d_min|
x = x - d_min * T[t_min];
y = y - d_min * T[t_min + 1];
y = z - d_min * T[t_min + 2];
Сука, блядь, пиздец, два часа убил.