- 1
- 2
[ThreadStatic]
private static SqlConnection _connection;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+129
[ThreadStatic]
private static SqlConnection _connection;
Всё самое худшее, что только можно додумать к этим двум строчкам, в наличии.
+117
if (!authorized)
{
// No, "I'm a teapot" is not what we really want, but the BuildMaster security module will
// replace it with a 401 (which we actually want)
context.Response.StatusCode = 418;
context.Response.Write("Not authorized");
context.Response.AddHeader("WWW-Authenticate", "Basic realm=\"BuildMaster URL Trigger\"");
context.ApplicationInstance.CompleteRequest();
return;
}
...
context.EndRequest += (s,e) =>
{
HttpApplication app = (HttpApplication)s;
if (app.Context.Response.StatusCode == 418)
app.Context.Response.StatusCode = 401;
}
http://blog.inedo.com/2010/10/12/http-418-im-a-teapot-finally-a-%E2%80%9Clegitimate%E2%80%9D-use/
Костыль для обхода "шибко умного" поведения ASP.NET Forms Authentication, который меняет код 401 на 302-перенаправление на форму логина. А разработчику нужен именно 401.
+15
typedef std::intptr_t difference_type;
//...
const difference_type index_relative_unsigned=std::abs(index_relative);
+118
<table width="630" border="1" class="main">
<!-- Распирай. Властвуй. Унижай. -->
<table border="1" width="800" class="main">
<tr align="center"><td class="tds">
....
</td></tr>
</table></table>
Цель была- просто впихнуть широкую таблицу, когда "голова", и кусок основной таблицы сайта (то, что до "распирай") отдаются скриптом. Дабы не вносить существенных поправок в движковую часть, и страницы- пришлось наговнокодить.
+130
* g o a t s e x * g o a t s e x * g o a t s e x *
g g
o / \ \ / \ o
a| | \ | | a
t| `. | | : t
s` | | \| | s
e \ | / / \\\ --__ \\ : e
x \ \/ _--~~ ~--__| \ | x
* \ \_-~ ~-_\ | *
g \_ \ _.--------.______\| | g
o \ \______// _ ___ _ (_(__> \ | o
a \ . C ___) ______ (_(____> | / a
t /\ | C ____)/ \ (_____> |_/ t
s / /\| C_____) | (___> / \ s
e | ( _C_____)\______/ // _/ / \ e
x | \ |__ \\_________// (__/ | x
* | \ \____) `---- --' | *
g | \_ ___\ /_ _/ | g
o | / | | \ | o
a | | / \ \ | a
t | / / | | \ |t
s | / / \__/\___/ | |s
e | / | | | |e
x | | | | | |x
* g o a t s e x * g o a t s e x * g o a t s e x *
+29
//thirteen
Cluster cl;
Cluster empty;
I--;
if(distances.size()){
for (int i = 0; i < (Lmax < distances.size() ? Lmax : distances.size()); ++i){
cl.X(( clusters.at(distances.at(i).first.first).X()*clusters.at(distances.at(i).first.first).Points().size() + clusters.at(distances.at(i).first.second).X()*clusters.at(distances.at(i).first.second).Points().size())/(clusters.at(distances.at(i).first.first).Points().size() + clusters.at(distances.at(i).first.second).Points().size()));
cl.Y(( clusters.at(distances.at(i).first.first).Y()*clusters.at(distances.at(i).first.first).Points().size() + clusters.at(distances.at(i).first.second).Y()*clusters.at(distances.at(i).first.second).Points().size())/(clusters.at(distances.at(i).first.first).Points().size() + clusters.at(distances.at(i).first.second).Points().size()));
if(clusters.at(distances.at(i).first.second).Number() != -1 && clusters.at(distances.at(i).first.first).Number() != -2){
cl.Points() = clusters.at(distances.at(i).first.second).Points();
clusters.at(distances.at(i).first.second) = cl;
clusters.at(distances.at(i).first.second).Number(-1);
for (std::vector<Point>::iterator j = clusters.at(distances.at(i).first.first).Points().begin(); j != clusters.at(distances.at(i).first.first).Points().end(); ++j)
{
clusters.at(distances.at(i).first.second).Points().push_back(*j);
}
clusters.at(distances.at(i).first.first) = empty;
n_c--;
}
}
for (std::vector<Cluster>::iterator i = clusters.begin(); i != clusters.end(); ++i){
if(i->Number() == -2){
i = clusters.erase(i);
}
i->Number(i - clusters.begin());
if(I)i->Points().clear();
if(i == clusters.end())break;
}
}
//fourteen
Кусок алгоритма isodata
+150
//
getMode: function(nMode) {
switch (nMode) {
case this.MODES.LEFT_BOOKEND:
return this.aModes[nMode];
case this.MODES.RIGHT_BOOKEND:
return this.aModes[nMode];
case this.MODES.BOTH_BOOKENDS:
return this.aModes[nMode];
case this.MODES.NONE:
default:
return this.aModes[this.MODES.NONE];
}
},
Наверное уже боян, но вот же он, опять!
https://github.com/scirelli/ExtjsBreadCrumbs/blob/master/js/ux/breadCrumbs.js
+63
//START ADDING CODE HERE TODAY. !!
Прямо посреди класса
+133
try
HeapSize += 268435456 -- +100500 могучих байт в кучу во имя производительности
catch (
try
HeapSize += 67108864 -- жалкая попытка добавить хоть что - то
catch
GIMS.Core.SystemMgr.ThrowError "init error" "Cannot extend the heap :(" -- сглотнуть обиду, поднасрав в лог
)
GC, you shall not pass!
Первая ступень попыток ускорить тормозной MAXScript
+162
switch ($isBlank) {
case true:
$seconds_to_cache = 1;
break;
case false:
$seconds_to_cache = 100000000;
break;
}
еще default: не хватает для полной красоты...