- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
#include <iostream>
int get_number() {
return 5;
}
int magic_number(int foo()) {
return foo();
}
int main(void)
{
std::cout << magic_number(get_number) << std::endl;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+49
#include <iostream>
int get_number() {
return 5;
}
int magic_number(int foo()) {
return foo();
}
int main(void)
{
std::cout << magic_number(get_number) << std::endl;
}
http://ideone.com/TbV0jD
+141
/* The DNS spec is officially case-insensitive, but for those times when you
*really* wanna see any and all discrepancies, by all means define this. */
#ifdef ANAL
if (strcmp (poop->name, hp->h_name) != 0) { /* case-sensitive */
#else
if (strcasecmp (poop->name, hp->h_name) != 0) { /* normal */
#endif
Из первой версии netcat'а.
+51
//Sets the color(background and foreground)
void Console::SetColor(){
#ifdef _WIN32
SetConsoleTextAttribute(hConsole, FGColor | BGColor);
#else
string clr = "\033[";
clr += BGColor;
clr += ";";
clr += FGColor;
clr += "m";
cout << clr;
#endif
}
Изменение цвета текста и фона консоли
+160
if ($sub_sub_sub_sub_category_id !== null) {
if ($this->core->countUrl > 5) {
header('Location: /404/');
}
foreach ($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id] as $k1 => $v1) {
if ($k1 !== 0) {
foreach ($v1 as $k2 => $v2) {
if ($k2 !== 0) {
if ($this->core->translit($v2[0]) == $sub_sub_sub_category) {
$sub_sub_sub_sub_sub_category_id = $k1;
$sub_sub_sub_sub_sub_sub_category_id = $k2;
break;
}
}
}
}
}
$this->core->title($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0]);
$bread_crumbs[] = array(
'text' => $categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0],
'url' => $location['alias'] . '/' . $this->core->translit($categories[$category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0])
);
$query_add = "
AND (`market_item`.`category_key` = '" . $category_id . "')
AND `market_item`.`param` REGEXP '(\"" . $sub_sub_sub_sub_category_id . "\")'
";
$vip_query_add = "
AND `market_item`.`category_key` = '" . $category_id . "'
";
}
+127
wct
http://habrahabr.ru/post/250713/
+127
http://i.gyazo.com/dd1b407b6ea528e59de2966e49d4cb82.png
Юзабилити)))
+164
window.onload = function (){
var divs=document.getElementsByTagName("DIV");
for( var i=0; i<divs.length; i++)
if(divs[i].className=="pro")
divs[i].style.minHeight=0+"px"
;
}
Целостность кода сохранена.
−109
def remove_duplicates(seq):
seen = set()
seen_add = seen.add
return [x for x in seq if x not in seen and not seen_add(x)]
замечательная функция, возвращающая уникальные элементы списка.
+74
/**
* singletone staff:
*/
private static LogisticsAppContext local;
Однотонный посох?
+158
if ( !defined ('BX_SKIP_INSTALL_CHECK') && file_exists( $dir['root'] . 'install' ) ) {
$ret = <<<EOJ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>Dolphin Installed</title>
<link href="{$site['url']}install/general.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body class="bx-def-font">
<div class="adm-header">
<div class="adm-header-content">
<div class="adm-header-title bx-def-margin-sec-left">
<img class="adm-header-logo" src="{$site['url']}administration/templates/base/images/logo.png" />
<div class="adm-header-text bx-def-font-h1">Dolphin {$site['ver']}</div>
<div class="clear_both"> </div>
</div>
<div class="clear_both"> </div>
</div>
</div>
<div id="bx-install-main" class="bx-def-border bx-def-round-corners bx-def-margin-top">
<div id="bx-install-content" class="bx-def-padding">
<div class="bx-install-header-caption bx-def-font-h1 bx-def-margin-bottom">
Well done, mate! Dolphin is now installed.
</div>
<div class="bx-install-header-text bx-def-font-large bx-def-font-grayed">
Remove directory called <b>"install"</b> from your server and <a href="{$site['url']}administration/modules.php">proceed to Admin Panel to install modules</a>.
</div>
</div>
</div>
</body>
</html>
EOJ;
echo $ret;
exit();
}
Какой веселый вывод HTML (Dolphin 7)