- 1
- 2
- 3
if (browser.opera && browser.version < 10.50) {
parent.innerHTML = parent.innerHTML;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+148
if (browser.opera && browser.version < 10.50) {
parent.innerHTML = parent.innerHTML;
}
http://vkontakte.ru/js/player.js?10 (c)
+115
<%=Convert.ToDateTime(item.CreatedOnDate).ToString("D", new System.Globalization.CultureInfo(System.Globalization.CultureInfo.CurrentCulture.ToString()))%>
Кусок кода, который отображает некую дату
+152
typedef signed int s32;
//...
void SomeStruct::SomeFunc(const char* ipImageName /*, ... */ )
{
// ...
s32 imageNameSize = strlen(ipImageName) * sizeof(char) + 1;
this->mpImageName = new char[imageNameSize];
strcpy(this->mpImageName, ipImageName);
// ...
}
А теперь представим, что вместо char будет wchar_t... ...автор - лид-программист...
+144
typedef signed int s32;
//...
void SomeStruct::SomeFunc(const char* ipImageName /*, ... */ )
{
// ...
s32 imageNameSize = strlen(ipImageName) * sizeof(char) + 1;
this->mpImageName = new char[imageNameSize];
strcpy(this->mpImageName, ipImageName);
// ...
}
А теперь представим, что вместо char будет wchar_t... ...автор - лид-программист...
−873
SELECT users.nick,group.name FROM users,group WHERE user.id='$id' AND group.id=user.group;
Это мой код. Мне сказали что это говнокод, и порекомендовали спросить здесь.
В чём именно говнокодость, и как надо писать правильно?
+158
#include <math.h>
#include <stdio.h>
double zero = 0, three = 3, four = 4;
class Complex
{
public:
double &x, &y;
Complex() : x(zero), y(zero) { }
Complex( double &z ) : x(y), y(z) { }
Complex( double &_x, double &_y ) : x(_x), y(_y) { }
};
double square( double const &x ) { return x * x; }
double absValue( Complex &c ) { return sqrt( square(c.x)+square(c.y) ); }
int main()
{
Complex c(four);
printf( "absolute value is %g\n", absValue( c ) );
return 0;
}
говно отсюда http://www.gimpel.com/html/bugs.htm
+154
function nameFilter(str){
var re = /^(oxypit|Штемп|хуй|пиде|пидр|пидо|пида|гыы|Techn|PIZDA)/i
if (re.test(str)) return true; else return false;
}
−98
lDate = DateSerial(Year(Date), Month(Date), Day(Date) - Day(Date) + 1)
Человек формирует дату - 1 число текущего месяца.
В каком классе учат упрощать выражения вида х-х+у?
+167
$filename_enc = urlencode($link);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=kino.css");
echo(file_get_contents("ftp://127.0.0.1/pub/films/06/1096/01/1096_01_01.mkv"));
+184
function reverse_string(str, len) {
if (len == 1) {
return str.charAt(0);
}
if (len == 2) {
return str.charAt(1) + str.charAt(0);
}
if (len == 3) {
return str.charAt(2) + str.charAt(1) + str.charAt(0);
}
if (len == 4) {
return str.charAt(3) + str.charAt(2) + str.charAt(1) + str.charAt(0);
}
if (len == 5) {
return str.charAt(4) + str.charAt(3) + str.charAt(2) + str.charAt(1) + str.charAt(0);
}
if (len == 6) {
return str.charAt(5) + str.charAt(5) + str.charAt(3) + str.charAt(2) + str.charAt(1) + str.charAt(0);
}
if (len == 7) {
return str.charAt(6) + str.charAt(5) + str.charAt(4) + str.charAt(3) + str.charAt(2) + str.charAt(1) + str.charAt(0);
}
if (len == 8) {
return str.charAt(7) + str.charAt(6) + str.charAt(5) + str.charAt(4) + str.charAt(3) + str.charAt(2) + str.charAt(1) + str.charAt(0);
}
if (len == 9) {
return str.charAt(8) + str.charAt(7) + str.charAt(6) + str.charAt(5) + str.charAt(4) + str.charAt(3) + str.charAt(2) + str.charAt(1) + str.charAt(0);
}
if (len == 10) {
return str.charAt(9) + str.charAt(8) + str.charAt(7) + str.charAt(6) + str.charAt(5) + str.charAt(4) + str.charAt(3) + str.charAt(2) + str.charAt(1) + str.charAt(0);
}
};
Переворачивание строки при помощи новейших технологий. Также ожидается движок (по содержанию конечно кусок говна, но по размерам похож), который позволит переворачивать строки любой длины (таким же методом). В-общем, прогноз неутешительный.