- 1
- 2
cur.execute("""SELECT EXTRACT(dow from DATE %(date)s)""", {"date" : datetime})
week = cur.fetchone()
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−114
cur.execute("""SELECT EXTRACT(dow from DATE %(date)s)""", {"date" : datetime})
week = cur.fetchone()
Я конечно знаю, что ГК про даты это плохой тон, но такого я еще не видел.
+76
private List< String > extractMetaDataLines()
{
final ArrayList< String > metaDataLines = new ArrayList< String >();
int currentLineIndex = 0;
int start = 0;
int end = 0;
for ( final String line : getLines() )
{
if ( line.contains( METADATA_TAG ) )
{
if ( line.contains( "</" ) )
{
end = currentLineIndex
- ( getLines().get( currentLineIndex - 1 ).contains( "]]>" ) ? 1
: 0 );
if ( line.contains( "<fx" )
|| line.contains( "<mx" ) )
{
start = end;
}
break;
}
if ( line.contains( "<" ) )
{
start = currentLineIndex
+ ( getLines().get( currentLineIndex + 1 ).contains( "CDATA[" ) ? 2
: 1 );
}
}
currentLineIndex++;
}
metaDataLines.addAll( getLines().subList( start,
end ) );
return metaDataLines;
}
build.xml:413: java.lang.IllegalArgumentException: fromIndex(12) > toIndex(11)
at java.util.ArrayList.subListRangeCheck(ArrayList.java:964)
at java.util.ArrayList.subList(ArrayList.java:954)
at com.adobe.ac.pmd.files.impl.MxmlFile.extractMetaDataLines(MxmlFile.java:262)
at com.adobe.ac.pmd.files.impl.MxmlFile.copyScriptLinesKeepingOriginalLineIndices(MxmlFile.java:191)
+159
null != localStorage.getItem("lock") && "2" == localStorage.getItem("lock") &&
($(".up_link").css("bottom", 0), $(".popular").removeClass("open")),
e.find(".door").on("click", function() {
return "2" == localStorage.getItem("lock") ?
($(".up_link").css("bottom", 80), e.addClass("open"),
localStorage.setItem("lock", "1")) :
($(".up_link").css("bottom", 0), e.removeClass("open"),
localStorage.setItem("lock", "2")), !1
});
Пример кода с echo.msk.ru
+53
{
...
_tswfstring contentID = fileName;
_tswfstring::size_type index = fileName.find_last_of ( _T("\\") );
if ( index != -1 )
contentID.erase(0, index + 1);
TCHAR name[10] = {0};
memcpy(name, contentID.c_str() + contentID.length() - 9, 9 * sizeof(TCHAR));
if(name[6] == _T('B') || name[6] == _T('b')) //to upper case if .bmp
{
name[6] = _T('B');
name[7] = _T('M');
name[8] = _T('P');
}
}
−109
if form.cleaned_data.has_key('replace_id') and type(form.cleaned_data['replace_id']) == type(32):
...
Логично, чо
+159
...
$personInfos = $query->getResult();
foreach ($personInfos as $personInfo) {
return $personInfo;
}
/* we lost our person */
return false;
Ребята-оутсорсеры насмешили наш отдел))
+159
var saveButtonStatus = (saveBtn.length != 0 && (!saveBtn.hasClass('disabled') && !saveBtn.is(':disabled') && !saveBtn.hasClass('ignore')) ) ? true : false;
if(saveButtonStatus) {
return true;
}
....
Валидация
−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.
+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 :) -->
...мм, Ок!