- 1
вайп
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+153
вайп
+118
private Excel._Application _excel;
...
private void RefreshFormulas(FormulaRefreshOption formulaRefreshOption, object objectToRefresh)
{
//Где-то в дебрях километрового метода бросилось в глаза
...
try
{
Excel.Range intersection = selection, selection2 = selection;
while (selection2 != null)
{
intersection = _excel.Intersect(selection2, selection2.Dependents,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
System.Windows.Forms.Application.DoEvents();
excelUtilities.RecalculateRangeInstance(true, intersection/*_excel.Selection as Excel.Range*/);
selection2 = intersection;
}
}
catch (Exception) { /*ignore the exception because .Dependents will throw an exception if there aren't any dependents*/}
...
}
−329
1
+144
1
+145
1
+145
$var
+144
$
+83
public String getNext() {
try {
return items[pointer];
} finally {
pointer++;
if(pointer >= items.length) {
pointer = 0;
}
}
}
+160
class Mysql_class {
function get_row($query) {
$sql_query = mysql_query($query) or exit(mysql_error());
return mysql_fetch_array($sql_query);
}
function single_query($query) {
if (mysql_query($query)) return true;
else return mysql_error();
}
}
2011-й год, прототип класса для работы с базой данных ( http://www.askdev.ru/q/8552 )
+156
exec(" cd $dir; ls -al|grep '^d';",$file_all);
//die(" cd $dir; ls -al|grep '^d';");
$filelist_date = array();
for($i=0;$i<count($file_all);$i++) {
$file_all[$i] = preg_replace('/\s+/','|',$file_all[$i]);
$file_all[$i] = explode('|',$file_all[$i],9);
if(!empty($file_all[$i][8])) $file_all[$i][8] = str_replace('|',' ',$file_all[$i][8]);
//print_r($file_all[$i]); echo "\n\n";
if($file_all[$i][8] == '.' || $file_all[$i][8] == '..') continue;
$k = strtotime($file_all[$i][5]." ".$file_all[$i][6]." ".$file_all[$i][7]);
$filelist_date[$k] = $file_all[$i][8];
}
krsort($filelist_date);
$filelist = array_values($filelist_date);
этот кусок кода выполняет начитку директорий фото галерей