- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
{
"result":
{
"session":"f759ca20-****-****-****-273ffc13a26d",
"version":"1.0"
},
"status":
{
"error":"ok",
"errorMessage":""
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+138
{
"result":
{
"session":"f759ca20-****-****-****-273ffc13a26d",
"version":"1.0"
},
"status":
{
"error":"ok",
"errorMessage":""
}
}
takoy vot error
+154
public static function ShowClaimsByManager($manager_id,$status,$offset_limit,$rows_limit){
$DBH = Registry::get('DBH');
$STH = $DBH ->prepare(
"SELECT * FROM claims,claims_status
WHERE claims.manager_id = :manager_id
AND claims.id = claims_status.claim_id
AND claims_status.status = :statusc
LIMIT :offsetl, :rowsl" );
$STH->bindParam(':manager_id', $manager_id, PDO::PARAM_STR);
$STH->bindParam(':statusc', $status, PDO::PARAM_STR);
$STH->bindParam(':offsetl', $offset_limit, PDO::PARAM_INT);
$STH->bindParam(':rowsl', $rows_limit, PDO::PARAM_INT);
$STH->execute();
$result = $STH->fetchAll(PDO::FETCH_ASSOC);
return $result;
}
Парень явно любит ctrl+c и ctrl+v
про $STH->execute($data); не не слышал.
−122
def contract_params
if params[:contract][:contract_type].to_i == 1
field = :contractor_id
else
field = :legal_entity_id
end
params.require(:contract).permit(
:contract_type,
:paid_expectation,
field
)
end
Much strong, very params.
−126
= simple_fields_for @med_program_template do |f|
- form ||= f # Страшное коварство
+137
#define SQR(x) ((x)*(x))
#define RANGE(x1, y1, x2, y2) (sqrt(SQR(x1-x2) + SQR(y1-y2)))
#define bestz z_b[b_iz]
#define bestv v_b[b_iv]
#define curz z_b[it]
#define curv v_b[i]
#define best_range (bestz.rast + RANGE(bestz.x, bestz.y, bestv.x, bestv.y) + bestv.rast)
#define current_range (curz.rast + RANGE(curz.x, curz.y, curv.x, curv.y) + curv.rast)
#define fci (l + ((r - l) / 3))
#define sci (r - ((r - l) / 3))
#define fc z_b[fci]
#define sc z_b[sci]
#define from v_b[i]
#define range_1 (from.rast + RANGE(from.x, from.y, fc.x, fc.y) + fc.rast)
#define range_2 (from.rast + RANGE(from.x, from.y, sc.x, sc.y) + sc.rast)
+160
<?php // if you delete this the sky will fall on your head
endwhile; //endwhile have_posts()
else: //have_posts()
?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
<!-- // this is just the end of the motor - don't touch that line either :) -->
...мм, Ок!
+132
.gen-tabs .acctab:hover, .gen-tabs .acctab:focus, .gen-tabs .acctab.current { Carat up! }
Говняшечка
+137
try {
/* ... */
} catch (\Exception $e) {
@trigger_error($e->getMessage(), E_USER_WARNING);
}
ini_set('tsundere_mode', '1');
+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);
+132
private double readDouble(string name, string wholeFile)
{
try
{
int ind = -1;
if ((ind = wholeFile.IndexOf(name)) != -1)
{
var restofstr = wholeFile.Substring(ind + name.Length);
int lineendind = -1;
lineendind = restofstr.IndexOfAny(new char[] { '\n', '\r', (char)13, (char)10 });
if (lineendind == -1 && restofstr.Length > 1)
{
lineendind = restofstr.Length;
}
if (lineendind != -1)
{
int eqind = -1;
string valueString = restofstr.Substring(0, lineendind);
if ((eqind = valueString.IndexOf("=")) != -1)
{
double res = 0.0;
if (Double.TryParse(valueString.Substring(eqind + 1).Trim(), out res))
{
return res;
}
}
}
}
}
catch (Exception) { }
return 0.0;
}
А как бы вы написали это?