- 1
- 2
- 3
- 4
- 5
- 6
var id = $('#block1').attr('id');
if( id == 'block1') {
$('.right').hide();
}else{
$('.right').show();
};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+169
var id = $('#block1').attr('id');
if( id == 'block1') {
$('.right').hide();
}else{
$('.right').show();
};
Шедевр.
−79
map_of_enemy :: [[Int]] -> [[Int]]
map_of_enemy [] = []
map_of_enemy list = (iniciar (0) (0) (list))
iniciar :: Int -> Int -> [[Int]] -> [[Int]]
iniciar a b list = if(a == (length list)-1) then [rango a 0 list]
else [rango a 0 list]++[(iniciar (a+1) 0 list)]
rango :: Int -> Int -> [[Int]] -> [Int]
rango a b list = if (b==(length list)-1 && (((list!!a!!0)==(list!!b!!0)) && ((list!!a!!1)==(list!!b!!1)) && ((list!!a!!2)==(list!!b!!2))))
then [0]
else if (b==(length list)-1 && (((list!!a!!0)/=(list!!b!!0)) || ((list!!a!!1)/=(list!!b!!1)) || ((list!!a!!2)/=(list!!b!!2))))
then (rango2 a (list!!b) list)
else if (((list!!a!!0)==(list!!b!!0)) && ((list!!a!!1)==(list!!b!!1)) && ((list!!a!!2)==(list!!b!!2)))
then [0]++(rango a (b+1) list)
else (rango2 a (list!!b) list)++(rango a (b+1) list)
rango2 :: Int -> [Int] -> [[Int]] -> [Int]
rango2 a b list = if ((verif [(list!!a!!0)+(list!!a!!2),(list!!a!!1)+(list!!a!!2)] [(list!!a!!0)-(list!!a!!2),(list!!a!!1)-(list!!a!!2)] (b))) then [1]
else [0]
verif a b c = if (((c!!0) < (a!!0)) && ((c!!0) > (b!!0)) && ((c!!1) < (a!!1)) && ((c!!1) > (b!!1))) then True
else if (((c!!0) < (a!!0)) && ((c!!0) == (b!!0)) && ((c!!1) < (a!!1)) && ((c!!1) == (b!!1))) then True
else if (((c!!0) == (a!!0)) && ((c!!0) > (b!!0)) && ((c!!1) == (a!!1)) && ((c!!1) > (b!!1))) then True
else False
Haskell
OMG mode on
+74
public final class TimeBasedRollingPolicy extends RollingPolicyBase
...
private int suffixLength = 0;
...
public void activateOptions() {
....
if (lastFileName.endsWith(".gz")) {
suffixLength = 3;
} else if (lastFileName.endsWith(".zip")) {
suffixLength = 4;
}
}
public RolloverDescription rollover(final String currentActiveFile) {
...
if (suffixLength == 3) {
compressAction =
new GZCompressAction(
new File(lastBaseName), new File(lastFileName), true);
}
if (suffixLength == 4) {
compressAction =
new ZipCompressAction(
new File(lastBaseName), new File(lastFileName), true);
}
...
}
}
Log4j
+166
function array_min_recursive($arr, &$peaks = array(), $current_key = '') {
return array_max_recursive($arr, $peaks, $current_key, true); // Неожиданно, правда?
}
+127
boolean loadPPOGroupCompleted(string customerRef, string competence, string marketArea) {
int i = 0;
table sceData = getPPOPODGroupSCEs(customerRef, competence, marketArea);
table dceData = getPPOPODGroupDCEs(customerRef, competence, marketArea);
table sbilData = getPPOPODGroupSbil(customerRef, competence, marketArea);
while (i < tableRowCount(sceData)) {
EventRec sce = convertStoredSCRtoEventRec(false, sceData, i, "", competence);
if ((string)tableGet(sceData, i, "ACTION_TYPE") == ACTION_REP) {
udrRoute(sce, "toSE_Agg_rer");
isReplaceAction = true;
} else {
udrRoute(sce, "toSE_Agg_evt");
}
i = i+ 1;
}
i = 0;
while (i < tableRowCount(dceData)) {
EventRec dce = convertStoredDCRtoEventRec(false, dceData, i, "", competence);
if ((string)tableGet(dceData, i, "ACTION_TYPE") == ACTION_REP) {
udrRoute(dce, "toSE_Agg_rer");
isReplaceAction = true;
} else {
udrRoute(dce, "toSE_Agg_evt");
}
i = i+ 1;
}
i = 0;
while (i < tableRowCount(sbilData)) {
EventRec sbilEvent = convertStoredSbiltoEventRec(sbilData, i, PPO_ZONALE, competence);
if ((string)tableGet(sbilData, i, "ACTION_TYPE") == ACTION_REP) {
udrRoute(sbilEvent, "toSE_Agg_rer");
isReplaceAction = true;
} else {
udrRoute(sbilEvent, "toSE_Agg_evt");
}
i = i + 1;
}
return true;
}
boolean loadGroupCompleted(string customerRef, string competence, date minStartDate) {
table sceData = getGroupSCEs(customerRef, competence);
table dceData = getGroupDCEs(customerRef, competence);
int i = 0;
string extPODCode, hour_date, hour_value, eventDTM, hourlyConsumption, totalF0GroupConsumption, treatmentType, consumptionType, actionType, edmID;
while (i < tableRowCount(sceData)) {
EventRec sce = convertStoredSCRtoEventRec(true, sceData, i, "", competence);
if ((string)tableGet(sceData, i, "ACTION_TYPE") == ACTION_REP) {
udrRoute(sce, "toSE_Agg_rer");
isReplaceAction = true;
} else {
udrRoute(sce, "toSE_Agg_evt");
}
i = i + 1;
}
i = 0;
while (i < tableRowCount(dceData)) {
EventRec dce = convertStoredDCRtoEventRec(true, dceData, i, "", competence);
if ((string)tableGet(dceData, i, "ACTION_TYPE") == ACTION_REP) {
udrRoute(dce, "toSE_Agg_rer");
isReplaceAction = true;
} else {
udrRoute(dce, "toSE_Agg_evt");
}
i = i + 1;
}
if (isGroupHasPPO(customerRef, minStartDate)) {
table sbilData = getPPOGroupSbil(customerRef, competence);
i = 0;
while (i < tableRowCount(sbilData)) {
EventRec sbilEvent = convertStoredSbiltoEventRec(sbilData, i, PPO_ZONALE, competence);
if ((string)tableGet(sbilData, i, "ACTION_TYPE") == ACTION_REP) {
udrRoute(sbilEvent, "toSE_Agg_rer");
isReplaceAction = true;
} else {
udrRoute(sbilEvent, "toSE_Agg_evt");
}
i = i + 1;
}
}
return true;
}
ctrl+c, ctrl+v
+158
$exp_date=$item['expiration_date'];
list($date,$time)=explode(' ',$exp_date);
list($day,$month,$year)=explode('/',$date);
echo $day.'.'.$month.'.'.$year.' '.$time;
работа с датой
преобразования из
05/12/2013 11:12:00
в
05.12.2013 11:12:00
−164
Процедура глЗагрузитьЗаказы() Экспорт
ОткрытьФорму("Отчет",,"\\SQLDSTR\1C\ExtERT\InvoiceLoader.ert");
КонецПроцедуры
Встретил в самописке в клюшках. Если поменяется имя сервера или каталога - всё рухнет).
+108
if (needParce)
{
try
{
count = decimal.Parse(tb_count.Text.Replace(".", ","));
}
catch
{
count = decimal.Parse(tb_count.Text.Replace(",", "."));
}
}
−127
Function Розница()
If Покупатель.Выбран() = 1 Then
If Покупатель.Вид() = "ПунктДоставки" Then
If Покупатель.Владелец.ТипЦенОтгрузки = Enum.ТипыОтпускныхЦен.Розничные Then
Return 1;
Else
Return 0;
EndIf;
Else
Return 0;
EndIf;
Else
Return 0;
EndIf;
EndFunction
Сегодня наткнулся на такой вот кусок кода
+136
// Определить тип ОС
string OSVersion = null;
try
{
try
{
OSVersion = Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\", "ProductName", "").ToString();
}
catch (NullReferenceException)
{
OSVersion = "";
}
}
catch (SecurityException)
{
OSVersion = "";
}
finally {} // иначе при вложенном try ошибка
Говницо собственного производства, когда учился программировать на первой работе.