- 1
- 2
- 3
if(e.password == '23f9dg'){
$('#editable').show(0);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+177
if(e.password == '23f9dg'){
$('#editable').show(0);
}
Клиентский JS, упоротым под баклофеном лучше не кодить...
+67
if ($is_past == "1")
{
if ($disable_sections == "1")
mysql_query("update setting set disable_sections = 1");
else
mysql_query("update setting set disable_sections = 0");
if ($disable_katalog_on_main_page == "1")
mysql_query("update setting set disable_katalog_on_main_page = 1");
else
mysql_query("update setting set disable_katalog_on_main_page = 0");
if ($disable_news_on_main_page == "1")
mysql_query("update setting set disable_news_on_main_page = 1");
else
mysql_query("update setting set disable_news_on_main_page = 0");
if ($disable_help_on_main_page == "1")
mysql_query("update setting set disable_help_on_main_page = 1");
else
mysql_query("update setting set disable_help_on_main_page = 0");
if ($disable_vote_on_main_page == "1")
mysql_query("update setting set disable_vote_on_main_page = 1");
else
mysql_query("update setting set disable_vote_on_main_page = 0");
if ($disable_zakaz_on_main_page == "1")
mysql_query("update setting set disable_zakaz_on_main_page = 1");
else
mysql_query("update setting set disable_zakaz_on_main_page = 0");
if ($disable_reklama_on_main_page == "1")
mysql_query("update setting set disable_reklama_on_main_page = 1");
else
mysql_query("update setting set disable_reklama_on_main_page = 0");
if (issets($main_page))
mysql_query("update setting set main_page = '$main_page'");
if (issets($count_news))
mysql_query("update setting set count_news = $count_news");
if (issets($count_spec))
mysql_query("update setting set count_spec = $count_spec");
if (issets($sort_type))
mysql_query("update setting set sort_type = $sort_type");
if (issets($email))
mysql_query("update setting set email = '$email'");
if (issets($formmail))
mysql_query("update setting set formmail = '$formmail'");
if (issets($techmail))
mysql_query("update setting set techmail = '$techmail'");
if (issets($tel2))
mysql_query("update setting set tel2 = '$tel2'");
if (issets($tel3))
mysql_query("update setting set tel3 = '$tel3'");
if (issets($tel4))
mysql_query("update setting set tel4 = '$tel4'");
if (issets($info))
mysql_query("update setting set info = '$info'");
}
Админка моей мечты! Здоровенная!!! :D
+70
<?php
$nodata = 'nodata';
$A60 = doubleval(@$HTTP_POST_VARS['A60']);
$B60 = doubleval(@$HTTP_POST_VARS['B60']);
$C60 = doubleval(@$HTTP_POST_VARS['C60']);
$D60 = doubleval(@$HTTP_POST_VARS['D60']);
$F60 = doubleval(@$HTTP_POST_VARS['F60']);
$G60 = doubleval(@$HTTP_POST_VARS['G60']);
$H60 = doubleval(@$HTTP_POST_VARS['H60']);
$I60 = doubleval(@$HTTP_POST_VARS['I60']);
$J60 = doubleval(@$HTTP_POST_VARS['J60']);
$K60 = doubleval(@$HTTP_POST_VARS['K60']);
$L60 = doubleval(@$HTTP_POST_VARS['L60']);
$M60 = doubleval(@$HTTP_POST_VARS['M60']);
echo $A60;
if (($A60 < 0) || ($B60 < 0) || ($C60 < 0) || ($D60 < 0) || ($F60 < 0) || ($G60 < 0) || ($H60 < 0) || ($I60 < 0) || ($J60 < 0) || ($K60 < 0) || ($L60 < 0) || ($M60 < 0)) {
readfile("cerror.html"); exit; }
if (($A60 == 0) && ($B60 == 0) && ($C60 == 0) && ($D60 == 0) && ($F60 == 0) && ($G60 == 0) && ($H60 == 0) && ($I60 == 0) && ($J60 == 0) && ($K60 == 0) && ($L60 == 0) && ($M60 == 0)) {
readfile("cerror.html"); exit;}
$D1 = @($A60);
$A2 = @(405.2);
$B2 = @((0.9 + 0.8) / 2);
$C2 = @(8);
$D2 = @($A60 / 3);
$E2 = @(0.00000012);
$F2 = @(exp(-1.60978 + 0.021845 * ($A2 / exp(3 * $B2)) - 0.000186 * pow($A2 / exp(3 * $B2), 2) + 0.0000011 * pow($A2 / exp(3 * $B2), 3)) * exp($B2 * (0.674 + 0.2 * $B2 + 0.007577 * ($A2 / exp(3 * $B2)) + 0.0084248753 * ($A2 / exp(3 * $B2)) * $B2 + 0.0000224434 * pow($A2 / exp(3 * $B2), 2))) * $E2 * $D2);
$I2 = @(0.37);
$J2 = @(0.24);
$K2 = @(0.22);
$A3 = @(368.7);
$B3 = @((0.9 + 0.8) / 2);
$C3 = @(20);
$D3 = @($A60 / 3);
$E3 = @(0.000000013);
$F3 = @(exp(-1.60978 + 0.021845 * ($A3 / exp(2.5 * $B3)) - 0.000186 * pow($A3 / exp(2.5 * $B3), 2) + 0.0000011 * pow($A3 / exp(2.5 * $B3), 3)) * exp($B3 * (0.674 + 0.2 * $B3 + 0.007577 * ($A3 / exp(2.5 * $B3)) + 0.0084248753 * ($A3 / exp(2.5 * $B3)) * $B3 + 0.0000224434 * pow($A3 / exp(2.5 * $B3), 2))) * $E3 * $D3);
$I3 = @(0.37);
$J3 = @(0.24);
$K3 = @(0.22);
$A4 = @(621.4);
$B4 = @(0.9);
$C4 = @(36);
$D4 = @($A60 / 3);
$E4 = @(0.00000001);
$F4 = @(exp(-1.60978 + 0.021845 * ($A4 / exp(2.5 * $B4)) - 0.000186 * pow($A4 / exp(2.5 * $B4), 2) + 0.0000011 * pow($A4 / exp(2.5 * $B4), 3)) * exp($B4 * (0.674 + 0.2 * $B4 + 0.007577 * ($A4 / exp(2.5 * $B4)) + 0.0084248753 * ($A4 / exp(2.5 * $B4)) * $B4 + 0.0000224434 * pow($A4 / exp(2.5 * $B4), 2))) * $E4 * $D4);
$I4 = @(0.37);
// ..аналогичные вычисления и инициализация для остальных переменных типа "буква-число"
$D54 = @($M60 / 2);
$E54 = @(0.0000007);
$I54 = @(0.192);
$J54 = @(0.027);
$K54 = @(0);
$A55 = @(232.5);
$B55 = @((0.5 + 0.8) / 2);
$C55 = @(0);
$D55 = @($M60 / 2);
$E55 = @(0.00000009);
$I55 = @(0.192);
$J55 = @(0.027);
$D56 = @($D53 + $D46 + $D47 + $D48 + $D40 + $D35 + $D30 + $D26 + $D22 + $D18 + $D13 + $D9 + $D5 + $D1);
// поехали по новой считать какие-то средние значения...
$A1 = @(($A2 + $A3 + $A4) / 3);
$B1 = @(($B2 + $B3 + $B4) / 3);
$C1 = @(($C2 + $C3 + $C4) / 3);
$E1 = @(($E2 + $E3 + $E4));
$F1 = @(($F2 + $F3 + $F4));
$I1 = @(($I2 + $I3 + $I4) / 3);
$J1 = @(($J2 + $J3 + $J4) / 3);
$K1 = @(($K2 + $K3 + $K4) / 3);
$H2 = @($F2 * ($I2 + $K2));
$M2 = @(1 - exp(-$H2 * 8766.00));
$H3 = @($F3 * ($I3 + $K3));
$M3 = @(1 - exp(-$H3 * 8766.00));
$H4 = @($F4 * ($I4 + $K4));
$M4 = @(1 - exp(-$H4 * 8766.00));
// ещё немного кода...
$J53 = @(($J54 + $J55) / 2);
$K53 = @(($K54 + $K55) / 2);
$F54 = @(exp(-3.94361687 + 0.02181877 * ($A55 / exp(5 * $B55)) + 0.00000171 * pow($A55 / exp(5 * $B55), 2)) * exp($B54 * (3.464157793 + 0.0000789055 * ($A55 / exp(5 * $B55)))) * $E54 * $D54);
$H54 = @($F54 * ($I54 + $K54));
$M54 = @(1 - exp(-$H54 * 8766.00));
$F55 = @(exp(-3.94361687 + 0.02181877 * ($A56 / exp(5 * $B56)) + 0.00000171 * pow($A56 / exp(5 * $B56), 2)) * exp($B55 * (3.464157793 + 0.0000789055 * ($A56 / exp(5 * $B56)))) * $E55 * $D55);
$H55 = @($F55 * ($I55 + $K55));
$M55 = @(1 - exp(-$H55 * 8766.00));
// и ешё чуть-чуть....
$F10 = @(((293 / (273 + $A10 / exp(4.5 * $B10) + 3000 * $B10 / (125 + $A10 / exp(4.5 * $B10)))) * exp((1 / (273 + $A10 / exp(4.5 * $B10) + 3000 * $B10 / (125 + $A10 / exp(4.5 * $B10)))) - (1.00 / 293.00) + 2 * ($B10 - 1))) * $E10 * $D10);
$H10 = @($F10 * ($I10 + $K10));
$M10 = @(1 - exp(-$H10 * 8766.00));
$F11 = @(((0.75 + 0.104 * $B11 * exp(0.877 * pow($B11, 3))) * (273 + ($A11 / exp(4.6 * $B11))) / 293) * exp((390 + 190 * $B11) * (($A11 / exp(4.6 * $B11)) - 20 + 0.016 * pow($B11 * ($A11 / exp(4.6 * $B11) - 20), 2)) / (293 * (273 + ($A11 / exp(4.6 * $B11))))) * $E11 * $D11);
$H11 = @($F11 * ($I11 + $K11));
$M11 = @(1 - exp(-$H11 * 8766.00));
$F12 = @((pow($B12, 2) + 0.01) * exp((4500 + 400 * $B12 + 1400 * pow($B12, 3)) * ((1.00 / 293.00) - (1 / (273 + ($A12 / exp(8 * $B12)))))) * $E12 * $D12);
$G12 = @(($H11 - $F11 * $K11) * ($A12 / exp(8 * $B12) / $A12));
$H12 = @($F12 * ($I12 + $K12));
$L12 = @((1 - exp(-$G12 * 8766.00)));
$M12 = @(1 - exp(-$H12 * 8766.00));
// 650+ строк таких вычислений для каждой буквы-переменной
?>
Код получает несколько значений: кол-во моторов, транзисторов, микросхем и прочих элементов, после считает разные коэффициенты пожароопасности и шансы возгорания. Записывает их в таблицу и показывает на странице. Говорят, что это работает верно и уже около 6 человек защитили курсовые по этой теме(пожароопасность электроприборов) с использованием этого кода.
+29
namespace NFlash
{
class TCommandMap
{
public:
typedef std::pair<NProtocolConsts::SCommands::E, pChar> TPair;
private:
std::vector<TPair> _commandMap;
public:
TCommandMap(void);
void appendCommand(TPair & Command);
void appendCommand(NProtocolConsts::SCommands::E, abstractString & Name);
const std::vector<TPair> & Names(void) const;
byte MaxCommandNameLength(void) const;
NProtocolConsts::SCommands::E GetCommandIndex(PChar Name) const;
};
void initCommandMaps(void);
}
+140
...
</table></td>
</tr>
<tr>
<td><img src="/img/ug2.jpg" width="200" height="11" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<?}else echo"<br><br>";?>
Особый, магический плэйсхолдер
+62
$date = substr($row[date], 0, 16);
$dat1 = explode(" ", $date);
$dat = explode("-", $dat1[0]);
$date = "$dat[2]/$dat[1]/$dat[0]";
Изящно
+69
public static void main(String[] args) throws Exception {
// ProblemFactory in action...
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setValidating(false);
docBuilderFactory.setNamespaceAware(false);
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
// I really don't want to download that stupid DTD from w3c.org
docBuilder.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
return new InputSource(new StringReader(""));
}
});
// Just fine
Document doc = docBuilder.parse("http://govnokod.ru/comments");
// ProblemFactory again
XPathFactory xpathFactory = XPathFactory.newInstance();
XPath xpath = xpathFactory.newXPath();
// Just fine
NodeList nodes = (NodeList)xpath.evaluate("//li[@class='hentry']", doc, XPathConstants.NODESET);
Pattern topicUriRegex = Pattern.compile("^.*/(\\d+)$");
// This is Java, not C. Why I need to write that shitty loop?!
for (int i=0, n=nodes.getLength(); i<n; i++) {
Node node = nodes.item(i);
String author = xpath.evaluate(".//strong[@class='entry-author']/a/text()", node);
String language = xpath.evaluate(".//a[@rel='chapter']/text()", node);
String topicUri = xpath.evaluate(".//a[@rel='bookmark'][@class='entry-title']/@href", node);
Matcher m = topicUriRegex.matcher(topicUri);
String topicId = m.matches() ? m.group(1) : "неизвестный говнокод";
String text = xpath.evaluate(".//div[@class='entry-comment']", node);
System.out.println("==== " + author + " наложил в " + topicId + " (" + language + ") ====");
System.out.println(text);
System.out.println("");
}
}
Треш угар и содомия.Java, DOM и парсер уютненького.
+39
extern const TSafeFloat Pi;//Не использовать до входа в main!!! Возможно она ещё не инициализированна!!!
//#define PI 3.14159265358979323846
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
Форматирование сохранено. Файл PiConsts.h
−160
<div class="comment-content">
<% if comment.body.include?('[/quote]') %>
<% @text = Array.new %>
<% summ = '' %>
<% @text = simple_format(comment.body).split(' ') %>
<% namecheck = false %>
<% contentcheck = false %>
<% quotestart = false %>
<% donothing = true %>
<% quotecount = 0 %>
<% count_quotes = 0 %>
<% @text.each do |t| %>
<% if t.include?('[/quote]') %>
<% count_quotes ||= 0 %>
<% count_quotes += 1 %>
<% end %>
<% end %>
<% @text.each do |t| %>
<% if t.include?('[/quote]') %>
<% contentcheck = false %>
<% namecheck = false %>
<% t = t.gsub('[/quote]', '</div></div>') %>
<% elsif t.include?('[quote=') %>
<% namecheck = true %>
<% donothing = false %>
<% t = t.gsub('[quote=', '') %>
<% elsif t.include?(']') %>
<% t = t.gsub(']', '') %>
<% end %>
<% if donothing == false %>
<% if contentcheck == true and namecheck == true and t != '' and t != '<p>' and t != '</p>' %>
<% t = '<div class=quotecontent>' + '<div class=quotestart>' + '<div class=quotename>' + 'Цитата - ' + t + '</div>' %>
<% contentcheck = true %>
<% namecheck = false %>
<% elsif contentcheck == true and t != '' and t != '<p>' and t != '</p>' %>
<% t = '<div class=quotecontent>' + t %>
<% contentcheck = false %>
<% elsif namecheck == true and t != '' and t != '<p>' and t != '</p>' %>
<% t = '<div class=quotestart>' + '<div class=quotename>' + 'Цитата - ' + t + '</div>' %>
<% namecheck = false %>
<% contentcheck = true %>
<% end %>
<% end %>
<% summ = summ + t + ' ' %>
<% end %>
<% else %>
<% summ = comment.body %>
<% end %>
<%=raw simple_format(summ) %>
</div>
Вьюха списка комментариев. Когда это попало к верстальщику - он был мягко говоря шокирован.
−102
-(void)tableView:(UITableView*)tableViewTable didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.row) {
case 0:
{
ViewControllerFavorites *contoller = [[ViewControllerFavorites alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 1:
{
ViewControllerMyAccount *contoller = [[ViewControllerMyAccount alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 2:
{
ViewControllerParts *contoller = [[ViewControllerParts alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 3:
{
ViewControllerFinancing *contoller = [[ViewControllerFinancing alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 4:
{
ViewControllerWebView *contoller = [[ViewControllerWebView alloc] initWithNibName:nil bundle:nil link:@"http://www.facebook.com"];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 5:
{
ViewControllerWebView *contoller = [[ViewControllerWebView alloc] initWithNibName:nil bundle:nil link:@"http://twitter.com"];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 6:
{
ViewControllerWebView *contoller = [[ViewControllerWebView alloc] initWithNibName:nil bundle:nil link:@"http://plus.google.com"];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 7:
{
ViewControllerLiveChat *contoller = [[ViewControllerLiveChat alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 8:
{
ViewControllerGasStations *contoller = [[ViewControllerGasStations alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 9:
{
ViewControllerVinScanner *contoller = [[ViewControllerVinScanner alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 10:
{
ViewControllerQRScanner *contoller = [[ViewControllerQRScanner alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 11:
{
ViewControllerNewsletter *contoller = [[ViewControllerNewsletter alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
case 12:
{
ViewControllerSettings *contoller = [[ViewControllerSettings alloc] initWithNibName:nil bundle:nil];
[contoller setNavigationController:navigationController];
[navigationController pushUIViewController:contoller WithName:[[[row getData] objectForKey:@"description"] uppercaseString]];
}
break;
default:
break;
}
Вот так в коммерческих проектах реализуют навигацию.