- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
/*
Func get_top($msg_number,$lines)
Access: Public
*/
function get_top( $msg_number , $lines = "0" )
{
// ....
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144.9
/*
Func get_top($msg_number,$lines)
Access: Public
*/
function get_top( $msg_number , $lines = "0" )
{
// ....
}
Очень ценный комментарий к функции, о одном классе.. Более того, там все каменты в этом стиле. Кэп снова с нами!
+134.5
static void Main(string[] args)
{
if (args.Length < 1)
Console.WriteLine("Usage:\n\tprogram <Folder> [output file]");
else if (args.Length == 1)
{
string outf = args[0] + "\\output.txt";
System.IO.File.WriteAllLines
(
outf,
new List<string>
(
System.IO.Directory.GetFiles(args[0])
)
.Concat(System.IO.Directory.GetDirectories(args[0]))
.ToArray()
);
}
else if(args.Length == 2)
{
string outf = args[1];
System.IO.File.WriteAllLines
(
outf,
new List<string>
(
System.IO.Directory.GetFiles(args[0])
)
.Concat(System.IO.Directory.GetDirectories(args[0]))
.ToArray()
);
}
}
Видите ли, я не знал как это сделать с помощью скриптовых языков виндовс.
−861.7
select ...
where ISNULL(e2e.ItemId, -1) = (case when @itemId < 1 then ISNULL(e2e.ItemId, -1) else @itemId end)
and ISNULL(e2e.LeftId, -1) = (case when @parentItemId < 1 then ISNULL(e2e.LeftId, -1) else @parentItemId) end
+161.5
$keys = array_keys($_POST);
$vals = array_values($_POST);
for($i=0; $i<=count($keys); $i++)
{
if($keys[$i]!='act' && $keys[$i]!='mode' && $keys[$i]!='pid')
{
$sql->Query('UPDATE `user_services_options` SET `value`=\''.$f->QuoteSql($vals[$i]).'\' WHERE `option`=\''.$f->QuoteSql($keys[$i]).'\' AND `service_id`='.$f->QuoteSql($service_id).' AND user_id='.$f->QuoteSql($user_id));
}
}
кагбе про foreach($_POST as $key => $value) я тогда и не знал.
+159.1
function dump_link($dump_id)
{
$a = date(G);
$b = date(i);
$c = date(s);
$day = date(j);
$mouth = date(n);
$year = date(Y);
$utc = date(Z);
$int = mktime($a, $b, $c, $mouth, $day, $year);
...
}
Наш ответ функции time()!
+73.4
String tempFileName = "someFileName";
URL url = SomeClass.class.getClassLoader().getResource(".");
File currentFolder = new File(url.getFile());
if(currentFolder.isDirectory()){
File parentFolder = currentFolder.getParentFile();
for (String file:parentFolder.list()) {
if(file.equals("temp")){
File targetFolder = new File(parentFolder.getAbsolutePath()+"\\"+file+"\\"+tempFileName);
if(!targetFolder.exists()) {
targetFolder.mkdir();
}
this.pathToTempFile = parentFolder.getAbsolutePath()+"\\"+file+"\\"+tempFileName;
}
}
}
Поиск директории для создания временных файлов вместо использования File.createTempFile(prefix, suffix)
+158.6
if(isset($_POST['submit']))
{
send($_POST['id_rep'],$_POST['name'],$_POST['city'],$_POST['other_city'],$_POST['kod_tel_1'],$_POST['tel_1'],$_POST['kod_tel_2'],$_POST['tel_2'],$_POST['prim'],$_POST['res'],$_POST['category'],$_POST['other_cat'],$_POST['check_uch'],$_POST['check_prep'],$_POST['district_uch'],$_POST['district_prep'],$_POST['stoim'],$_POST['email'],$_POST['icq'],$_POST['whence_came'],$_POST['text_whence_came'],$_POST['one_teacher']);
}
else
{
form($id_teacher,$_POST['name'],$_POST['city'],$_POST['other_city'],$_POST['kod_tel_1'],$_POST['tel_1'],$_POST['kod_tel_2'],$_POST['tel_2'],$_POST['prim'],$_POST['res'],$_POST['category'],$_POST['other_cat'],$_POST['check_uch'],$_POST['check_prep'],$_POST['district_uch'],$_POST['district_prep'],$_POST['stoim'],$_POST['email'],$_POST['icq'],$_POST['whence_came'],$_POST['text_whence_came'],$_POST['one_teacher']);
}
Как на самом деле правильно обрабатывать формы.
+146.7
if (k.innerHTML=='0') {} else {gtim()}
+153.3
echo "<pre {$stat_class}>{$pars}<input id='fast_{$tlists['tid']}' type='checkbox' name='tlsite[]' value='{$tlists['tid']}' />
<label for='fast_{$tlists['tid']}'> {$tlists['file']} <span style='color:#808080; font-size:10px;'>({$tlists['date']})</span>
- {$tlists['name']}
</label>
[<a href='edit.php?tid={$tlists['tid']}' onClick=\"popupWin = window.open(this.href, 'contacts', 'width=800,height=600,top=150,left=150'); popupWin.focus(); return false;\" >ed</a>] </pre>";
нечто
+147.8
for (var i = 0; i = 20; i++;) {
$('minus-', i).hide();
}
Плевать на ; в конце (ачепятко), но i = 0 и i = 20... :)