- 1
- 2
- 3
- 4
if (!($user_info['room'] == 900002) || $user_info['room'] != 900002) {
header("Location: main.php");
die();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+177
if (!($user_info['room'] == 900002) || $user_info['room'] != 900002) {
header("Location: main.php");
die();
}
Разгребаю чужой код и нарыл.
Чтобы условие выглядело посолидней ... или я чего-нить не понимаю.
+144
<?php
$valueOne = (5 > 1) ? true : false;
?>
http://en.wikipedia.org/wiki/%3F:#PHP
+141
sprintf(name," %s", trim("рубль",0));
Функция trim(char*, int), где вторым параметром указывается с какой стороны удалять пробелы(0 - с обеих сторон)
+86
new Date(System.currentTimeMillis());
Просто и со вкусом
+144
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}else{
if ((intYear % 4) == 0) { return true; }
}
return false;
}
Пистец %)
надыбал скриптец в проекте при чистке. Так индусы считали високостный год %))
походу сразу %4 не работает %) или тут зарыт какой-то мэйджик смысл? %) ы
+170
var a1 = Math.floor(Math.random()*15 + 1);
var a2 = Math.floor(Math.random()*15 + 1);
mismatch(2);
var a3 = Math.floor(Math.random()*15 + 1);
mismatch(3);
var a4 = Math.floor(Math.random()*15 + 1);
mismatch(4);
var a5 = Math.floor(Math.random()*15 + 1);
mismatch(5);
var a6 = Math.floor(Math.random()*15 + 1);
mismatch(6);
var a7 = Math.floor(Math.random()*15 + 1);
mismatch(7);
var a8 = Math.floor(Math.random()*15 + 1);
mismatch(8);
var a9 = Math.floor(Math.random()*15 + 1);
mismatch(9);
var a10 = Math.floor(Math.random()*15 + 1);
mismatch(10);
var a11 = Math.floor(Math.random()*15 + 1);
mismatch(11);
var a12 = Math.floor(Math.random()*15 + 1);
mismatch(12);
var a13 = Math.floor(Math.random()*15 + 1);
mismatch(13);
var a14 = Math.floor(Math.random()*15 + 1);
mismatch(14);
var a15 = Math.floor(Math.random()*15 + 1);
mismatch(15);
Это и многое другое на http://ru.wikiversity.org/wiki/15_puzzle
+162
/*
Макрос генерирует внутренности функции-заглушки OpenGL.
*/
#define BWT_DECLARE_OPENGL_PROC_IMPL(PROC, PROC_TYPE, ...) \
static PROC_TYPE _##PROC = 0; \
\
if (_##PROC) \
return _##PROC(__VA_ARGS__); \
else \
{ \
_##PROC = TryToGetProcAddress<PROC_TYPE>(#PROC); return _##PROC(__VA_ARGS__); \
}
/*
Функция получает адрес функции, или возбуждает исключение, если адрес получить не удалось.
*/
template<typename proc_type>
proc_type TryToGetProcAddress(const char *proc_name) throw(error_type<VIDEO>)
{
proc_type address = reinterpret_cast<proc_type>(::SDL_GL_GetProcAddress(proc_name));
if (!address)
BWT_THROW_VIDEO_ERROR(UNDEFINED_ERROR, "OpenGL version does not supported");
return address;
}
GLAPI void APIENTRY glCullFace (GLenum mode)
{
BWT_DECLARE_OPENGL_PROC_IMPL(glCullFace, PFNGLCULLFACEPROC, mode);
}
...
+144
void addSlash( const char* command, char* sdo )
{
int command_length;
char *command_line = command;
command_length = strlen(command);
while(command_length>0){
switch(*command_line){
case '"':
strcpy(sdo+strlen(sdo),"\\");
default:
strcpy(sdo+strlen(sdo), command_line);
}
command_line++;
command_length--;
}
}
Должно быть добавление слешей перед двойными кавычками.
+169
/* создать задачу */
function add_problem($value) {
...
}
+1001
string GetStringHash(string S)
{
MD5 md = MD5.Create();
byte[] B = md.ComputeHash(Encoding.UTF8.GetBytes(S));
return string.Format("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}",
B[0x00], B[0x01], B[0x02], B[0x03], B[0x04], B[0x05], B[0x06], B[0x07],
B[0x08], B[0x09], B[0x0A], B[0x0B], B[0x0C], B[0x0D], B[0x0E], B[0x0F]);
}
Запостил: 4eburashka, прямо перед выпилом ресурса.