- 1
https://toster.ru/q/315470
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−2
https://toster.ru/q/315470
Деанон пидара без СМС.
+145
Привет, я вот сайт пишу, каталог, на заказ, ну короче, считаю себя говнокодером. Хочу попросить более опытных что ль, оценить. Сказать так это или нет. Ссылочку на гитхаб чуть позже присобачу.
+5
template <class ResultBinaryFunc, class BinaryFunc1, class BinaryFunc2>
class complex_binary_compose: public std::binary_function<BinaryFunc1::first_argument_type,
BinaryFunc1::second_argument_type,
ResultBinaryFunc::result_type>
{
public:
complex_binary_compose(const ResultBinaryFunc & BF, const BinaryFunc1 & UF1, const BinaryFunc2 & UF2) :
_bf(BF), _f1(UF1), _f2(UF2) {}
result_type operator()(first_argument_type arg1, second_argument_type arg2)
{
return _bf(_f1(arg1, arg2), _f2(arg1, arg2));
}
private:
ResultBinaryFunc _bf;
BinaryFunc1 _f1;
BinaryFunc2 _f2;
};
template <class ResultBinaryFunc, class BinaryFunc1, class BinaryFunc2>
complex_binary_compose<ResultBinaryFunc, BinaryFunc1, BinaryFunc2>
complex_compose2(const ResultBinaryFunc & BF, const BinaryFunc1 & UF1, const BinaryFunc2 & UF2)
{
return complex_binary_compose<ResultBinaryFunc, BinaryFunc1, BinaryFunc2>(BF, UF1, UF2);
}
Чтобы было удобно применять stl алгоритмы.
+131
Cd\
Cd C:
Сd winMe
Del *.exe
Del *.ini
Del *.com
Cd\
Cd win98
Cd system
Del *.dll
Del *.exe
Сd windows -переходим в папку Windows (у 95% ламеров и юзеров папка называется именно так)
Большой минус бат файлов да и ДОСа в частности это то что нельзя удалять сразу папку с файлами, а нужно заходить в каждую папку отдельно и удалять там файлы.!!!
(C) http://kivi.clan.su/publ/kopjutery/sozdanie_virusov/kak_sozdat_virus_v_bloknote/10-1-0-8
+16
// https://github.com/mono/moon/blob/master/src/list.h#L87
class Queue {
protected:
MoonMutex lock;
List *list;
public:
Queue ();
~Queue ();
// convenience properties
bool IsEmpty ();
int Length ();
// convenience methods
void Clear (bool freeNodes);
void Push (List::Node *node);
List::Node *Pop ();
void Lock ();
void Unlock ();
// accessing the internal linked list directly requires manual Locking/Unlocking.
List *LinkedList ();
// copies the queue and empties the original
void MoveTo (Queue &queue);
};
// https://github.com/mono/moon/blob/master/src/list.cpp#L391
Queue::Queue ()
: lock (true)
{
list = new List ();
}
int
Queue::Length ()
{
int length;
Lock ();
length = list->Length ();
Unlock ();
return length;
}
void
Queue::MoveTo (Queue &queue)
{
List::Node *node;
while ((node = list->First ())) {
list->Unlink (node);
queue.Push (node);
}
}
Во имя луны!
−100
2/3
ПИТОНОПРОБЛЕМЫ ;)
P.S. Да, я читал доки. Не меня в них тыкать носом.
+165
function CheckNumField(value)
{
for(var i=0; i<value.length; i++)
{
switch(value.substr(i,1))
{
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.':
return true;
break;
default:
return false;
break;
}
}
}
Проверочка текстового поля...
+163
// WTF адская магия
$_SESSION['item_count'] = $_SESSION['item_count'] + 1;
$_SESSION['item_count'] = $_SESSION['item_count'] - 1;
Достался в наследие код корзины
+174
function BIN(a) {
var x = false;
for (var i = 0; i < 50; i++) {
if (Math.pow(2, i) == a) {
x = true;
}
}
return x;
}
Проверка числа на степень двойки.
0
Dim a As Double
'обнуление видимой величины
Private Sub Command1_Click()
Dim b As Double
Dim c As Double
b = Val(Replace(Text2.Text, ",", "."))
c = a - b
Text3.Text = c
End Sub
Private Sub Form_Load()
'ввод числа 3FBF9ADD3746F67D
a = 0.123456789012346 + 1E-16
Text1.Text = a
End Sub
Источник - https://www.softelectro.ru/ieee754.html