- 1
- 2
- 3
- 4
.inbox-page-list {
float: left;
position: fixed;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+7
.inbox-page-list {
float: left;
position: fixed;
}
мой филиппинский коллега, после которого часто приходится переделывать
+2
....
SetFormPopup("/" & pageName & ".htm")
pageName = pageName.Replace("(", "-")
pageName = pageName.Replace(")", "-")
pageName = pageName.Replace("&", "-")
pageName = pageName.Replace(",", "-")
pageName = pageName.Replace("""", "-")
pageName = pageName.Replace("'", "-")
pageName = pageName.Replace("_", "-")
pageName = pageName.Replace("?", "-")
pageName = pageName.Replace(".-", "-")
pageName = pageName.Replace("-------", "-")
pageName = pageName.Replace("------", "-")
pageName = pageName.Replace("-----", "-")
pageName = pageName.Replace("----", "-")
pageName = pageName.Replace("---", "-")
pageName = pageName.Replace("--", "-")
pageName = pageName.Trim("-")
....
+5
<ul style="display:none" class="displaynone2">
<li>
<a href="/catalog?q=Колесо&how=r">Колесо</a>
</li>
</ul>
Наверняка где-то в черторгах ждёт элемент с классом "displaynone:nachalo"
+3
#ifndef DEFINES
#define DEFINES
#define _W_CALL(a,b) a b
#define _W_NARGS_OVERRIDE(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, N, ...) N
#define _W_NARGS(...) _W_NARGS_OVERRIDE("ignored", ##__VA_ARGS__, 10, 9, 8, 7, 6 ,5, 4, 3, 2, 1, 0)
#define _W_GETPARAM1(_1,...) _1
#define _W_GETPARAM2(_1,_2,...) _2
#define _W_GETPARAM3(_1,_2,_3,...) _3
#define _W_ARG_OVERRIDE(_1, _2, _3, NAME, ...) NAME
#define _W_ARG2(a,b) (a,b)
#define _W_ARG3(a,b,c) (a,b,c)
#define W_ARG(...) _W_ARG_OVERRIDE(__VA_ARGS__, _W_ARG3, _W_ARG2)(__VA_ARGS__)
#define _W_ARGNAME2(a,b) b
#define _W_ARGNAME3(a,b,c) b
#define _W_ARGNAME_(...) _W_ARG_OVERRIDE(__VA_ARGS__, _W_ARGNAME3, _W_ARGNAME2)(__VA_ARGS__)
#define _W_ARGNAME(a) _W_ARGNAME_ a
#define _W_ARGPREP2(a,b) a b
#define _W_ARGPREP3(a,b,c) a bc
#define _W_ARGPREP_(...) _W_ARG_OVERRIDE(__VA_ARGS__, _W_ARGPREP3, _W_ARGPREP2)(__VA_ARGS__)
#define _W_ARGPREP(a) _W_ARGPREP_ a
#define _W_FUNCTPARAM1(a) _W_ARGPREP(a)
#define _W_FUNCTPARAM2(a,b) _W_ARGPREP(a), _W_ARGPREP(b)
#define _W_FUNCTPARAM3(a,b,c) _W_ARGPREP(a) , _W_ARGPREP(b) , _W_ARGPREP(c)
#define _W_FUNCTPARAM4(a,b,c,d) _W_ARGPREP(a) , _W_ARGPREP(b) , _W_ARGPREP(c) , _W_ARGPREP(d)
#define _W_FUNCTPARAM5(a,b,c,d,e) _W_ARGPREP(a) , _W_ARGPREP(b) , _W_ARGPREP(c) , _W_ARGPREP(d) , _W_ARGPREP(e)
#define _W_FUNCTPARAM6(a,b,c,d,e,f) _W_ARGPREP(a) , _W_ARGPREP(b) , _W_ARGPREP(c) , _W_ARGPREP(d) , _W_ARGPREP(e) , _W_ARGPREP(f)
#define _W_FUNCTPARAM7(a,b,c,d,e,f,g) _W_ARGPREP(a) , _W_ARGPREP(b) , _W_ARGPREP(c) , _W_ARGPREP(d) , _W_ARGPREP(e) , _W_ARGPREP(f), _W_ARGPREP(g)
#define _W_FUNCTPARAM8(a,b,c,d,e,f,g,h) _W_ARGPREP(a) , _W_ARGPREP(b) , _W_ARGPREP(c) , _W_ARGPREP(d) , _W_ARGPREP(e) , _W_ARGPREP(f), _W_ARGPREP(g), _W_ARGPREP(h)
#define _W_FUNCTPARAM9(a,b,c,d,e,f,g,h,i) _W_ARGPREP(a) , _W_ARGPREP(b) , _W_ARGPREP(c) , _W_ARGPREP(d) , _W_ARGPREP(e) , _W_ARGPREP(f), _W_ARGPREP(g), _W_ARGPREP(h), _W_ARGPREP(i)
#define _W_FUNCTPARAM10(a,b,c,d,e,f,g,h,i,j) _W_ARGPREP(a) , _W_ARGPREP(b) , _W_ARGPREP(c) , _W_ARGPREP(d) , _W_ARGPREP(e) , _W_ARGPREP(f), _W_ARGPREP(g), _W_ARGPREP(h), _W_ARGPREP(i), _W_ARGPREP(j)
#define _W_FUNCTPARAMS_OVERRIDE(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, NAME, ...) NAME
#define _W_FUNCTPARAMS(...) _W_FUNCTPARAMS_OVERRIDE(__VA_ARGS__,_W_FUNCTPARAM10,_W_FUNCTPARAM9,_W_FUNCTPARAM8,_W_FUNCTPARAM7,_W_FUNCTPARAM6,_W_FUNCTPARAM5,_W_FUNCTPARAM4,_W_FUNCTPARAM3,_W_FUNCTPARAM2,_W_FUNCTPARAM1)(__VA_ARGS__)
#define _W_FUNCTNAME1(a) _W_ARGNAME(a)
#define _W_FUNCTNAME2(a,b) _W_ARGNAME(a), _W_ARGNAME(b)
#define _W_FUNCTNAME3(a,b,c) _W_ARGNAME(a) , _W_ARGNAME(b) , _W_ARGNAME(c)
#define _W_FUNCTNAME4(a,b,c,d) _W_ARGNAME(a) , _W_ARGNAME(b) , _W_ARGNAME(c) , _W_ARGNAME(d)
#define _W_FUNCTNAME5(a,b,c,d,e) _W_ARGNAME(a) , _W_ARGNAME(b) , _W_ARGNAME(c) , _W_ARGNAME(d) , _W_ARGNAME(e)
#define _W_FUNCTNAME6(a,b,c,d,e,f) _W_ARGNAME(a) , _W_ARGNAME(b) , _W_ARGNAME(c) , _W_ARGNAME(d) , _W_ARGNAME(e) , _W_ARGNAME(f)
#define _W_FUNCTNAME7(a,b,c,d,e,f,g) _W_ARGNAME(a) , _W_ARGNAME(b) , _W_ARGNAME(c) , _W_ARGNAME(d) , _W_ARGNAME(e) , _W_ARGNAME(f), _W_ARGNAME(g)
#define _W_FUNCTNAME8(a,b,c,d,e,f,g,h) _W_ARGNAME(a) , _W_ARGNAME(b) , _W_ARGNAME(c) , _W_ARGNAME(d) , _W_ARGNAME(e) , _W_ARGNAME(f), _W_ARGNAME(g), _W_ARGNAME(h)
#define _W_FUNCTNAME9(a,b,c,d,e,f,g,h,i) _W_ARGNAME(a) , _W_ARGNAME(b) , _W_ARGNAME(c) , _W_ARGNAME(d) , _W_ARGNAME(e) , _W_ARGNAME(f), _W_ARGNAME(g), _W_ARGNAME(h), _W_ARGNAME(i)
#define _W_FUNCTNAME10(a,b,c,d,e,f,g,h,i,j) _W_ARGNAME(a) , _W_ARGNAME(b) , _W_ARGNAME(c) , _W_ARGNAME(d) , _W_ARGNAME(e) , _W_ARGNAME(f), _W_ARGNAME(g), _W_ARGNAME(h), _W_ARGNAME(i), _W_ARGNAME(j)
#define _W_FUNCTNAMES_OVERRIDE(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, NAME, ...) NAME
#define _W_FUNCTNAMES(...) _W_FUNCTNAMES_OVERRIDE(__VA_ARGS__,_W_FUNCTNAME10,_W_FUNCTNAME9,_W_FUNCTNAME8,_W_FUNCTNAME7,_W_FUNCTNAME6,_W_FUNCTNAME5,_W_FUNCTNAME4,_W_FUNCTNAME3,_W_FUNCTNAME2,_W_FUNCTNAME1)(__VA_ARGS__)
#define W_FUNCT(className, retType, functName, ...) \
private: \
retType _##functName( _W_FUNCTPARAMS(__VA_ARGS__) ); \
retType (className::*__##functName)( _W_FUNCTPARAMS(__VA_ARGS__) ); \
public: \
retType functName( _W_FUNCTPARAMS(__VA_ARGS__) ) { return (this->*__##functName)( _W_FUNCTNAMES(__VA_ARGS__) ); }
#define W_FUNCT_REL(className, functName, classPointer) classPointer->__##functName = & className::_##functName;
#define _W_STRING(X) #X
#endif // DEFINES
Немножко надэфайнил.
−1
continueSaving(item, item);
В node.js 3 вызова функции continueSaving, первый объект новый, второй старый из бд, в самой функции проверяется наличие старого объекта и если есть то он используется, в остальных вызовах все нормально.
+1
class DBUSLIB_EXPORT DBusLib : public QObject
{
Q_OBJECT
public:
DBusLib(QObject* parent = 0);
void requestId(const QString &req, const int &reqTimeOut);
QByteArray replyData;
QString name;
MyPair reqStruct; // id, partsCount
QVector<QByteArray> vecFile;
int partsCount; //кол-во частей
int parts; //кол-во пришедших
QTimer *timer = new QTimer(this);
signals:
void doneSignal(QByteArray& fileData);
public slots:
void requestMap(const MyPair &dbm);
void partsFile(const MyPair &part);
void requestFail(const QDBusError& error);
void timeIsOver();
};
Студент принес говна. Паблик морозов, ценные комментарии и все такое.
Вот только мне любопытна 14 строчка. C++11 не включен.
Конпелятор mingw492 выбрасывает ворнинг
D:\projects\test_dbus\client_v2\client_l ib\dbuslib.h:35: предупреждение: non-static data member initializers only available with -std=c++11 or -std=gnu++11
QTimer *timer = new QTimer(this);
^
Но при этом все компилится и работает. Значит, 03 стандарт разрешает такое?
+3
public function findByEventId($eventId) {
return $this->findByEventId($eventId);
}
Я просто оставлю это здесь...
+5
img[src=""]{
display:none;
}
Super-genius
+2
case 'create': {
promisesCount.create++;
try {
var data = item.data;
data.status = 'new';
data.syncItemType = item.data.itemType;
} catch (e) {
console.log('create');
console.log(e);
console.log(e.stack);
}
return new vow.Promise(function(resolve, reject){
//resolve();
app.crud.create('items', data, req.user).then(function () {
resolve();
}, function (error) {
reject(error)
});
});
}
case 'update': {
promisesCount.update++;
try{
var data = item.actual;
data.citiesPrices = item.data.citiesPrices;
if (item.actual.type == 'brick') {
for(var key in data.citiesPrices) {
data.citiesPrices[key] = item.data.citiesPrices.brickAllRegion;
}
}
data.syncItemType = item.data.itemType;
if (item.actual.type && item.actual.status == 'site') {
if (item.actual.type == 'brick') {
if (!item.data.convertion || !item.data.convertion.piecesInPalette || !item.data.convertion.piecesPerMeter) {
/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
wrongItems.push(item);
wrongItemsCount.brick++;
} else {
rightItemsCount.brick++;
data.countInPallet = item.data.convertion.piecesInPalette;
data.piecesPerMeter = item.data.convertion.piecesPerMeter;
}
} else {
if (item.data.measure && ['кв.м.', 'шт.'].indexOf(item.data.measure) != -1) {
switch(item.data.measure) {
case 'кв.м.': {
if (!item.data.convertion || !item.data.convertion.metersInPalette || !item.data.convertion.metersInBox || !item.data.convertion.metersInPiece) {
/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
wrongItems.push(item);
wrongItemsCount.clinkerItems++;
} else {
rightItemsCount.clinkerItems++;
data.countInPallet = parseInt(item.data.convertion.metersInPalette / item.data.convertion.metersInBox);
data.countInPack = parseInt(item.data.convertion.metersInBox / item.data.convertion.metersInPiece);
}
break;
}
case 'шт.': {
if (!item.data.convertion || !item.data.convertion.piecesInBox) {
/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
wrongItems.push(item);
wrongItemsCount.clinkerMeters++;
} else {
rightItemsCount.clinkerMeters++;
data.countInPack = item.data.convertion.piecesInBox;
}
break;
}
}
}
}
}
} catch(e) {
console.log('update');
console.log(e);
console.log(e.stack);
}
Хороший, читабельный код от предыдущих разрабов
+1
var promise = new Promise(function (reject, resolve) {
$.ajax({
url: url,
method: method,
contentType: 'application/json',
headers: headers,
data: JSON.stringify(data),
success: function (response) {
resolve(response);
},
error: function (error) {
reject(error);
}
});
});