- 1
- 2
- 3
//
// TEMPLATE CLASS vector<bool, Alloc> AND FRIENDS
//
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
//
// TEMPLATE CLASS vector<bool, Alloc> AND FRIENDS
//
0xB друзей Вектора.
via UCRT <vector>
+7
https://static.googleusercontent.com/media/research.google.com/ru//pubs/archive/43438.pdf
> provide cluster management solutions that typically scale to O(1000) machines
Мдааа, вот вам и пиэйчди из гугла. Я думал, в о-нотацию не умеют только 1024-- и школьники с хабра.
+5
if ($count == 1 or $count == 21 or $count == 31 or $count == 41 or $count == 51 or $count == 61 or $count == 71 or $count == 81) ( $str = ' товар');
if ($count == 2 or $count == 3 or $count == 4 or $count == 22 or $count == 23 or $count == 24 or $count == 32 or $count == 33 or $count == 34 or $count == 42 or $count == 43 or $count == 44 or $count == 52 or $count == 53 or $count == 54 or $count == 62 or $count == 63 or $count == 64) ( $str = ' товара');
if ($count == 5 or $count == 6 or $count == 7 or $count == 8 or $count == 9 or $count == 10 or $count == 11 or $count == 12 or $count == 13 or $count == 14 or $count == 15 or $count == 16 or $count == 17 or $count == 18 or $count == 19 or $count == 20 or $count == 25 or $count == 26 or $count == 27 or $count == 28 or $count == 29 or $count == 30 or $count == 35 or $count == 36 or $count == 37 or $count == 38 or $count == 39 or $count == 40 or $count == 45 or $count == 46 or $count == 47 or $count == 48 or $count == 49 or $count == 50 or $count == 55 or $count == 56 or $count == 57 or $count == 58 or $count == 59 or $count == 60 or $count == 65) ( $str = ' товаров');
if ($count > 81){
$str=" тов";
}
Бронебойный pluralize
+2
// куча if и небольшой кусок логики
// ...
} else {
response["message"] = "Access Denied";
response.shortlist = undefined;
callback(response);
}
} else {
response["message"] = "Access Denied";
response.shortlist = undefined;
callback(response);
}
} else {
response["message"] = "Access Denied";
response.shortlist = undefined;
callback(response);
}
});
} else {
response["message"] = "Access Denied";
response.shortlist = undefined;
callback(response);
}
} else {
response["message"] = "Access Denied";
response.shortlist = undefined;
callback(response);
}
} else {
response["message"] = "Access Denied";
response.shortlist = undefined;
callback(response);
}
} else {
response["message"] = "Invalid Method";
response.shortlist = undefined;
callback(response);
}
−13
for i=1,1000 do
str = string.format("xyi%i", i)
f = io.open(str, "w")
f:write("я вирус! приветикиии")
f:flush()
f:close()
end
оцениваем по 1000 бальной шкале плиз!
−6
#include <stdio.h>
//аналог стрингбилдеру который есть в java!!!
#define NUM 1000 //максимальный размер строки
typedef struct {
char str[NUM];
} StringBuilder;
void append(StringBuilder *sb, char *str) //добавление строки
{
sprintf(sb->str, "%s%s", sb->str, str); //гениально и просто хули
}
void setLength(StringBuilder *sb, int s)
{
if(s > NUM || s < 0) return; //жуть
sb->str[s]='\0'; //гениальнетибл!
}
int main()
{
StringBuilder sb;
sprintf(sb.str, "Привет америкосам");
printf("%s\n", sb.str);
append(&sb, ", я вас уделаю!");
printf("%s\n", sb.str);
setLength(&sb, 2);
printf("%s\n", sb.str);
setLength(&sb, 0);
printf("%s\n", sb.str);
return 0;
}
понос или не понос вот в чем вопрос
−7
#include <stdio.h>
// Бесконечный дождик на экране! Ахуенчик ёпта
int main()
{
char c = '\\';
while(1)
{
for(int i=0; i<20; i++)
{
usleep(1000);
for(int sp=0;sp<i;sp++) printf(" "); //печатаем пробелы
printf("%c", c);
}
}
}
−6
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
if(argc != 2)
printf("НЕПРАВИЛЬНА: %s [ЧИСЛО]\n", argv[0]);
else
{
int d=atoi(argv[1]); //отработает в любом случае
for(int i=0; i<d; i++) {
sleep(1);
printf(".\n");
}
}
return 0;
}
−8
#include <stdio.h>
#include <time.h>
int main(int argc, char const *argv[])
{
printf("Подождите...\n");
long start = time(NULL);
FILE *f;
f = fopen("test", "w");
if(f == NULL) {
perror("fopen");
return 1;
}
for(int i=0; i<10000000; i++)
fputs("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW", f);
fclose(f);
long stop = time(NULL);
long sec = stop-start;
int result = 1000/sec;
printf("Результат: секунд:%li скорость:%iмб/с\n", sec, result);
return 0;
}
понос.c
−6
//Program ".c"
#include <sys/random.h>
#include <stdio.h>
int main() //non documented
{
char a[10];
int r = getrandom(&a, 10, GRND_NONBLOCK);
if(r == -1) return r;
FILE *f = fopen("rnd", "w");
if(f == NULL) return -1;
r = fputs(a, f);
if(r == EOF) return r;
r = fclose(f);
if(r == -1) return r;
return 0;
}