- 1
. ldd
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−118
. ldd
Роняет bash
+155
if (in_array ($v["field_currency_out"]["und"][0]["tid"], array(20, 21, 26, 27,153,157,154,152,155,162)) || in_array ($v["field_currency_in"]["und"][0]["tid"], array(22, 23, 24, 25,151,156,150,149,148,161))) {
$v["field_payment"]["und"][0]["tid"] = 28;
} else {
$v["field_payment"]["und"][0]["tid"]= 13;
}
Представте что весь сайт написан в этом же духе.
Причем мы имеем дело с двома наборами констант для обозначения валют - для входа и выхода перевода.
+57
char val;
//...
switch(val)
{
case '0': mOn = true; break;
default: mOn = false; break;
}
+131
std::string new_artifact()
{
if (one_in(2)) { // Generate a "tool" artifact
it_artifact_tool *art = new it_artifact_tool();
int form = rng(ARTTOOLFORM_NULL + 1, NUM_ARTTOOLFORMS - 1);
artifact_tool_form_datum *info = &(artifact_tool_form_data[form]);
art->create_name(info->name);
art->color = info->color;
art->sym = info->sym;
art->materials.push_back(info->material);
art->volume = rng(info->volume_min, info->volume_max);
art->weight = rng(info->weight_min, info->weight_max);
// Set up the basic weapon type
artifact_weapon_datum *weapon = &(artifact_weapon_data[info->base_weapon]);
art->melee_dam = rng(weapon->bash_min, weapon->bash_max);
art->melee_cut = rng(weapon->cut_min, weapon->cut_max);
art->m_to_hit = rng(weapon->to_hit_min, weapon->to_hit_max);
if( weapon->tag != "" ) {
art->item_tags.insert(weapon->tag);
}
// Add an extra weapon perhaps?
if (one_in(2)) {
int select = rng(0, 2);
if (info->extra_weapons[select] != ARTWEAP_NULL) {
weapon = &(artifact_weapon_data[ info->extra_weapons[select] ]);
art->volume += weapon->volume;
art->weight += weapon->weight;
art->melee_dam += rng(weapon->bash_min, weapon->bash_max);
art->melee_cut += rng(weapon->cut_min, weapon->cut_max);
art->m_to_hit += rng(weapon->to_hit_min, weapon->to_hit_max);
if( weapon->tag != "" ) {
art->item_tags.insert(weapon->tag);
}
std::stringstream newname;
newname << weapon->adjective << " " << info->name;
art->create_name(newname.str());
}
}
// CHOP is a sword, STAB is a dagger
if( art->item_tags.count( "CHOP" ) > 0 ) {
art->item_tags.insert( "SHEATH_SWORD" );
}
if( art->item_tags.count( "STAB" ) > 0 ) {
art->item_tags.insert( "SHEATH_KNIFE" );
}
art->description = string_format(
_("This is the %s.\nIt is the only one of its kind.\nIt may have unknown powers; try activating them."),
art->nname(1).c_str());
// Finally, pick some powers
art_effect_passive passive_tmp = AEP_NULL;
art_effect_active active_tmp = AEA_NULL;
int num_good = 0, num_bad = 0, value = 0;
std::vector<art_effect_passive> good_effects = fill_good_passive();
std::vector<art_effect_passive> bad_effects = fill_bad_passive();
// Wielded effects first
while (!good_effects.empty() && !bad_effects.empty() &&
num_good < 3 && num_bad < 3 &&
(num_good < 1 || num_bad < 1 || one_in(num_good + 1) ||
one_in(num_bad + 1) || value > 1)) {
if (value < 1 && one_in(2)) { // Good
int index = rng(0, good_effects.size() - 1);
passive_tmp = good_effects[index];
good_effects.erase(good_effects.begin() + index);
num_good++;
} else if (!bad_effects.empty()) { // Bad effect
int index = rng(0, bad_effects.size() - 1);
passive_tmp = bad_effects[index];
bad_effects.erase(bad_effects.begin() + index);
num_bad++;
}
value += passive_effect_cost[passive_tmp];
art->effects_wielded.push_back(passive_tmp);
}
// Next, carried effects; more likely to be just bad
num_good = 0;
num_bad = 0;
value = 0;
good_effects = fill_good_passive();
bad_effects = fill_bad_passive();
while (one_in(2) && !good_effects.empty() && !bad_effects.empty() &&
num_good < 3 && num_bad < 3 &&
((num_good > 2 && one_in(num_good + 1)) || num_bad < 1 ||
one_in(num_bad + 1) || value > 1)) {
if (value < 1 && one_in(3)) { // Good
int index = rng(0, good_effects.size() - 1);
passive_tmp = good_effects[index];
good_effects.erase(good_effects.begin() + index);
num_good++;
} else { // Bad effect
int index = rng(0, bad_effects.size() - 1);
passive_tmp = bad_effects[index];
bad_effects.erase(bad_effects.begin() + index);
num_bad++;
}
value += passive_effect_cost[passive_tmp];
art->effects_carried.push_back(passive_tmp);
−396
BOOL = omg;
if (omg == YES)
{
[self go];
}
else
{
if (omg == YES)
{
omg = YES;
[self go];
}
}
МОИ ГЛАЗАААА
+59
if ( number % 10 == 0 ) {
number %= 10;
}
мне кажется, или...
+160
$('div.body').css('height', '100%').parent('body').css('height', '100%').parent('html').css('height', '100%');
Долой css и здравый смысл!
+50
namespace Memory
{
#include <malloc.h>
}
+162
class StupidClass
{
public function __toString()
{
return 'this';
}
public function hax()
{
return $this === $$$$$$this;
}
}
var_dump((new StupidClass)->hax()); // true
Уииии
+127
alias Foo(V : V[]) = V;
dlang, угадайте, что этот код делает.