- 1
- 2
- 3
- 4
- 5
- 6
- 7
<?php
function get_user() {
// функция перенесена в secure.func.php
$user = get_user();
return $user;
}
?>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+163.6
<?php
function get_user() {
// функция перенесена в secure.func.php
$user = get_user();
return $user;
}
?>
−149
1С 8.1
Вот как надо таблицу значений очищать..))
ТЗДанные.Очистить();
Пока 1 = 1 Цикл
Если ТЗДанные.Колонки.Количество() = 0 Тогда
Прервать;
КонецЕсли;
ТЗДанные.Колонки.Удалить(0);
КонецЦикла;
И ещё бы контрольный... была бы сказка....
ТЗДанные = Новый ТаблицаЗначений;
+149.8
//простите меня за эти строки, но просто альтернативный метод swapNode (нативный только в IE)
//удаляет оригинальный нод и его приходится заново по id искать :(
document.getElementById(element['drag'].id).style.border = "2px solid gray";
document.getElementById(element['acce'].id).style.border = "2px solid gray";
:))))
каммент жжот
мой старый JS-быдлокод
+157.2
function validate($allsubmitted){
$massage="";
$passwords= $allsubmitted["pword"];
$firstpass= $passwords[0];
$secondpass= $passwords[1];
$username= $allsubmitted["name"];
if ($firstpass!= $secondpass){
$massage=$massage."Пароль верен<br>";
} else {
$massage=$massage."Не правильно введен пароль";
}
if (strlen($username)<5 || strlen($username)>50){
$massage= $massage."Ник должен быть от 5 до 50 символов";
}
if ($massage==""){
$massage= "clear";
}
return $massage;
}
validate($_POST);
if (validate($_POST)=="clear"){
echo "Спасибо за регистрацию!";
} else {
echo "У Вас возникли проблемы с регистрацией!";
}
"***: Привет всем, http://www.govnokod.com/1488 подскжите что не парвильно в этом говнокоде? вбивал данные и правильные и не правильные, результат один: У Вас возникли проблемы с регистрацией!"
мы все учились понемногу ©
+157.2
if(preg_match("/\.[gjpi][ipnc][fgo]/i", $_SERVER['REQUEST_URI'])) exit;
+8.1
// файлToolStripMenuItem
//
this->файлToolStripMenuItem->Name = L"файлToolStripMenuItem";
this->файлToolStripMenuItem->Size = System::Drawing::Size(54, 22);
this->файлToolStripMenuItem->Text = L"Файл";
this->файлToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::файлToolStripMenuItem_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 260);
this->Controls->Add(this->button1);
this->Controls->Add(this->menuStrip1);
this->MainMenuStrip = this->menuStrip1;
this->Name = L"Form1";
this->Text = L"Form1";
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void меню1ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void файлToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void выходToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
}
};
MS VS 2005 - MS VS 2008 это спокойно компилирует, да ещё и сама код генерирует, когда на формочке рисуешь русское меню.
Этот компилятор определённо соответсвует стандарту С++.
+12.1
class TIntArray
{
char buf[10000];
int operator[](int Index);
};
...
void main()
{
TIntArray a;
...
memset(&a[1],0.0f,sizeof(TIntArray));
...
};
Меня этот кот довёл до слёз...
+13.1
#define REGISTER_PACKET(cls, type)\
__declspec(selectany) PacketType cls::s_type = CPacketFactory::RegisterPacket(type, cls::CreateNew); \
__pragma(comment(linker, "/include:?s_type@##cls##@@2W4PacketType@@C"))
Очень правильный код... Делать можно только так.
+136
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <math.h>
#include <stdlib.h>
struct thread_arg
{
int a;
int b;
int c;
double d;
};
void *ret_x1(void *arg)
{
struct thread_arg targ = *(struct thread_arg *)arg;
double x1;
x1 = (-targ.b + sqrt(targ.d)) / (2*targ.a);
fprintf(stderr, "x1 = %f\n", x1);
return NULL;
}
void *ret_x2(void *arg)
{
struct thread_arg targ = *(struct thread_arg*)arg;
double x2;
x2 = (-targ.b - sqrt(targ.d)) / (2*targ.a);
fprintf(stderr, "x2 = %f\n", x2);
return NULL;
}
int main(void)
{
pthread_t thread1, thread2;
struct thread_arg args;
fprintf(stderr, "Enter a, b and c\n");
scanf("%d %d %d", &args.a, &args.b, &args.c);
args.d = args.b*args.b - 4*args.a*args.c;
if(args.d < 0)
{
fprintf(stderr,"There is no roots\n");
return 0;
}
else
{
if(pthread_create(&thread1, NULL, &ret_x1, &args) != 0)
{
fprintf(stderr, "Error1\n");
return 1;
}
if(pthread_create(&thread2, NULL, &ret_x2, &args) != 0)
{
fprintf(stderr, "Error2\n");
return 1;
}
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
}
return 0;
}
Многопоточное решение квадратного уравнения...
+155
$cnt_ = count($array_objects['rate']);
for($i=0; $i<$cnt_; $i++) {
//...
}
$DB->query('REPAIR TABLE `' . $rates_table . '` QUICK;');
Кусок скрипта для импорта данных из XML...