- 1
Интересно, а кто-нибудь пользуется кнопками "Tweet" и "Нравится" под постами?
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 102
−32
Интересно, а кто-нибудь пользуется кнопками "Tweet" и "Нравится" под постами?
−47
function agreeForm(f) {
// Если поставлен флажок, снимаем блокирование кнопки
if (f.agree.checked) f.submit.disabled = 0;
// В противном случае вновь блокируем кнопку
else f.submit.disabled = 1;
}
−22
int myAtoi(char *string)
{
int result = 0;
bool is_negative = false;
int num[10];
int s_lenght = strlen(string);
int mn = 1;
for(int i = s_lenght – 1; i >= 0; i–)
{
char chTemp = string[i];
switch(chTemp)
{
case ’0′:
num[i] = 0;
break;
case ’1′:
num[i] = 1;
break;
case ’2′:
num[i] = 2;
break;
case ’3′:
num[i] = 3;
break;
case ’4′:
num[i] = 4;
break;
case ’5′:
num[i] = 5;
break;
case ’6′:
num[i] = 6;
break;
case ’7′:
num[i] = 7;
break;
case ’8′:
num[i] = 8;
break;
case ’9′:
num[i] = 9;
break;
case ‘-’:
is_negative = true;
break;
}
if(!is_negative)
{
result += num[i] * mn;
mn *= 10;
}
}
if(is_negative)
result = -result;
return result;
}
−22
/*
TOP SECRET Microsoft(c) Code
Project: Chicago(tm)
Projected release-date: Summer 1998
*/
#include "win31.h"
#include "win95.h"
#include "evenmore.h"
#include "oldstuff.h"
#include "billrulz.h"
#define INSTALL = HARD
char make_prog_look_big[1600000];
void main()
{
while(!CRASHED)
{
display_copyright_message();
display_bill_rules_message();
do_nothing_loop();
if (first_time_installation)
{
make_50_megabyte_swapfile();
do_nothing_loop();
totally_screw_up_HPFS_file_system();
search_and_destroy_the_rest_of_OS/2();
hang_system();
}
write_something(anything);
display_copyright_message();
do_nothing_loop();
do_some_stuff();
if (still_not_crashed)
{
display_copyright_message();
do_nothing_loop();
basically_run_windows_3.1();
do_nothing_loop();
do_nothing_loop();
}
}
if (detect_cache())
disable_cache();
if (fast_cpu())
{
set_wait_states(lots);
set_mouse(speed, very_slow);
set_mouse(action, jumpy);
set_mouse(reaction, sometimes);
}
/* printf("Welcome to Windows 3.11"); */
/* printf("Welcome to Windows 95"); */
printf("Welcome to Windows 98");
if (system_ok())
crash(to_dos_prompt);
else
system_memory = open("a:\swp0001.swp",
O_CREATE);
while(something)
{
sleep(5);
get_user_input();
sleep(5);
act_on_user_input();
sleep(5);
}
create_general_protection_fault();
}
−45
if(pEnum > 10){
alert('Я тебе голову сломаю!');
pEnum = 0;
}
−19
static MessageException()
{
kinds = new MessageKindsSet();
kinds.AddError("error", "error: <0>");
kinds.AddAttention("attention", "warning: <0>");
kinds.AddNormalMessage("message", "<0>");
kinds.AddError("out_of_bounds", "<0> out of <1>..<2>");
kinds.AddError("dont_be_here", "Should dont be here!");
kinds.AddError("not_found", "<0> not found!");
kinds.AddError("not_equal", "<0> not equals <1>");
kinds.AddError("equal", "<0> equals <1>, but they must be differrence!");
kinds.AddError("equals_null", "<0> is null!!");
kinds.AddError("excess_item", "Item '<0>' is excess");
kinds.AddError("expected_item", "Expected '<0>'");
kinds.AddError("unexpected_item", "Encountered unexpected item '<0>'");
kinds.AddError("wrong_item", "Wrong item '<0>'");
kinds.AddError("expected_other_item", "Expected '<0>' but encountered '<1>'");
kinds.AddError("unknown_item", "item '<0>' is unknown");
kinds.AddError("file_not_found", "File '<0>' not found");
kinds.AddError("wrong_file_extension", "File '<0>' has wrong extension");
kinds.AddError("expected_eol", "Expected end of line but encountered '<0>'");
kinds.AddError("expected_not_eol", "End of line unexpected!");
}
private void MakeTplParams()
{
Object[] obj = originalTplParams;
String[] str = new String[obj.Length];
int length = str.Length;
for (int i = 0; i < length; i++)
{
str[i] = !Object.ReferenceEquals(obj[i], null) ? obj[i].ToString() : "";
}
tplParams = str;
}
private String CreateText()
{
MakeTplParams();
Message kind = kinds.Get(kindName);
if (kind != null)
{
return MakeText(kind.TextTemplate);
}
else
{
return MakeDefaultText();
}
}
private String MakeText(String tpl)
{
MakeTplParams();
if (tpl == "")
{
return MakeDefaultText();
}
else
{
return MakeTextByTemplate(tpl);
}
}
private String MakeTextByTemplate(String tpl)
{
String builder = tpl;
int length = tplParams.Length;
for (int i = 0; i < length; i++)
{
builder = builder.Replace("<" + i + ">", (tplParams[i]));
}
return builder;
}
private String MakeDefaultText()
{
String builder = "";
builder += "[" + kindName + "] :";
int length = tplParams.Length;
for (int i = 0; i < length; i++)
{
builder += (tplParams[i]) + "; ";
}
return builder;
}
−20
public delegate WriteLineInt32 WriteLineInt32(int value);
public static WriteLineInt32WriteLine(int value)
{
Console.WriteLine(value);
return WriteLine;
}
−19
#define KdpQuickMoveMemory(dst, src, len) memcpy((dst), (src), (len))
−40
$db->query("SET NAMES 'utf8'"); // Я почему то не смог нормально записать)
−45
function S_Prnt_Str (options) {
if (options.stroka.length >= 0) {
if (typeof options.stroka == typeof 'string') {
if (console) {
if ('console' in window) {
if ('log' in window.console) {
try {
console.log(options.stroka);
} catch (owibka) {
throw owibka;
}
} else {
throw new Error('Net funccii log');
}
} else {
throw new Error('Konsoli net v window');
}
} else {
throw new Error('Konsoli net');
}
} else {
throw new Error('Eto ne stroka');
}
} else {
throw new Error('U stroki net length');
}
}
cho = true;
try {
for (i = 1; i <= 6; i++) {
if (cho == true) {
try {
stroka = '';
for (j = 1; j <= i; j++) {
if (stroka == '') {
stroka = stroka + j;
} else {
stroka = stroka + '-' + j;
}
}
S_Prnt_Str({stroka: stroka});
cho = false;
} catch (owibka) {
if (owibka instanceof Error) {
throw new Error(owibka.message);
} else {
throw new Error('Owibka ne owibka');
}
}
} else if (cho == false) {
try {
stroka = '';
for (j = 1; j <= i; j++) {
if (stroka == '') {
stroka = stroka + j;
} else {
stroka = j + '-' + stroka;
}
}
S_Prnt_Str({stroka: stroka});
cho = true;
} catch (owibka) {
if (owibka instanceof Error) {
throw new Error(owibka.message);
} else {
throw new Error('Owibka ne owibka');
}
}
} else {
throw new Error('Owibka!!!');
}
}
} catch (owibka) {
if (owibka instanceof Error) {
throw new Error(owibka.message);
} else {
throw new Error('Owibka ne owibka');
}
}