- 1
- 2
- 3
- 4
- 5
public ActionResult View(string id)
{
// some stupid code
return View("Picture");
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+122
public ActionResult View(string id)
{
// some stupid code
return View("Picture");
}
Потратил больше часа, пытаясь разобраться, почему глючат роуты.
+172
/*Diablo (18:24:45 10/12/2010)
кароче я форму вынес в отдельный файл
Diablo (18:24:50 10/12/2010)
и хотел прицепить её так
Diablo (18:24:55 10/12/2010)*/
$addform = include "post_city.php";
echo ( "$addform" );
/*Aios (18:24:45 10/12/2010)
и как? работает?))*/
/*Diablo (18:24:50 10/12/2010)
не ( белую страничку выдает*/
Я был в шоке)))
+163
function replaceBBCodes($text){
$text=str_replace("/\n/m", "$0<br/>", $text);
$text = htmlspecialchars($text);
$text=nl2br($text);
$text=stripslashes($text);
$text=str_replace("!#3040#!", "&", $text);
$text=str_replace('[b]', '<strong>', $text);
$text=str_replace('[/b]', '</strong>', $text);
$text=str_replace('[i]', '<em>', $text);
$text=str_replace('[/i]', '</em>', $text);
$text=str_replace('[u]', '<u>', $text);
$text=str_replace('[/u]', '</u>', $text);
$text=str_replace('[s]', '<s>', $text);
$text=str_replace('[/s]', '</s>', $text);
$text=str_replace('[left]', '<span class="bb_left">', $text);
$text=str_replace('[/left]', '</span>', $text);
$text=str_replace('[right]', '<span class="bb_right">', $text);
$text=str_replace('[/right]', '</span>', $text);
$text=str_replace('[center]', '<span class="bb_center">', $text);
$text=str_replace('[/center]', '</span>', $text);
$text=str_replace('[justify]', '<span class="bb_justify">', $text);
$text=str_replace('[/justify]', '</span>', $text);
$text=preg_replace("#\[color=(.*?)](.*?)\[/color\]#si", '<span style="color:$1">$2</span>',$text);
$text=preg_replace("#\[size=(.*?)](.*?)\[/size\]#si", '<span style="font-size:$1px">$2</span>',$text);
$text=preg_replace("#\[a=(.*?)](.*?)\[/a\]#si", '<a href="$1">$2</a>',$text);
$text=preg_replace("#\[img=(.*?)](.*?)\[/img\]#si", '<img src="$2" alt="images" style="float:$1;margin:5px;" />',$text);
$text=preg_replace("#\[youtube](.*?)\[/youtube\]#si",'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',$text);
$text=preg_replace("#\[youtube](.*?)\[/youtube\]#si",'<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>',$text);
$text=preg_replace("#\[spoiler=(.*?)](.*?)\[/spoiler\]#si", '<div id=\'video\'><h1 class="headtt2" onclick="expandit(this)">$1</h1>
<div style="display:none;" class="sdsp"> $2</div> </div>', $text);
$text=preg_replace("#\[podspoiler=(.*?)](.*?)\[/podspoiler\]#si", '<h1 class="headtt" onclick="expandit(this)">$1</h1>
<div style="display:none;text-align:center">$2</div>', $text);
return $text;
}
+165
<?php
header("Content-Type: text/html; charset=windows-1251");
defined('_JEXEC') or die('<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/0.7.59</center>
</body>
</html>');
$url = $_SERVER['HTTP_HOST'];
$host = $_SERVER['DOCUMENT_ROOT'];
if(!file_exists($host."/data/conf.php")) die("Система не установленна!");
include $host.'/data/conf.php';
function generate_password($a)
{
if($a==1){
return rand(111111,99999999); }
else if($a==2){
$arr = array('a','b','c','d','e','f',
'g','h','i','j','k','l',
'm','n','o','p','r','s',
't','u','v','x','y','z',
); $pass = "";
$n = rand(6,10);
for($i = 0; $i < $n; $i++)
{
$index = rand(0, count($arr) - 1);
$pass .= $arr[$index];
}
return $pass; }
else if($a==3){
$arr = array('a','b','c','d','e','f',
'g','h','i','j','k','l',
'm','n','o','p','r','s',
't','u','v','x','y','z',
'A','B','C','D','E','F',
'G','H','I','J','K','L',
'M','N','O','P','R','S',
'T','U','V','X','Y','Z',
); $pass = "";
$n = rand(6,10);
for($i = 0; $i < $n; $i++)
{
$index = rand(0, count($arr) - 1);
$pass .= $arr[$index];
}
return $pass; }
else if($a==4){
$arr = array('a','b','c','d','e','f',
'g','h','i','j','k','l',
'm','n','o','p','r','s',
't','u','v','x','y','z',
'A','B','C','D','E','F',
'G','H','I','J','K','L',
'M','N','O','P','R','S',
'T','U','V','X','Y','Z',
'1','2','3','4','5','6',
'7','8','9','0',
); $pass = "";
$n = rand(10,16);
for($i = 0; $i < $n; $i++)
{
$index = rand(0, count($arr) - 1);
$pass .= $arr[$index];
}
return $pass; }
else if($a==5){
$arr = array('a','b','c','d','e','f',
'g','h','i','j','k','l',
'm','n','o','p','r','s',
't','u','v','x','y','z',
'A','B','C','D','E','F',
'G','H','I','J','K','L',
'M','N','O','P','R','S',
'T','U','V','X','Y','Z',
'1','2','3','4','5','6',
'7','8','9','0','.',',',
'(',')','[',']','!','?',
); $pass = "";
$n = rand(10,16);
for($i = 0; $i < $n; $i++)
{
$index = rand(0, count($arr) - 1);
$pass .= $arr[$index];
}
return $pass; }
} // генератор паролей
+102
function FileIsBusy(AFileName: string): Boolean;
var
F: Integer;
begin
F := FileOpen(AFileName, fmShareExclusive);
Result := F = -1;
FileClose(F);
end;
function WaitFile(AFileName: string; ASpeepDelay: integer): Boolean;
begin
while FileIsBusy(AFileName) do
Sleep(ASpeepDelay);
Result := True;
end;
пока юзверь ковыряется в Ворде, другой процесс мечтает овладеть файлом
"It is necessary to wait of end of editing Microsoft Office files.I use next conventional approach: file is editing While file is busy" (ингриш - питерского разлива)
это stackoverflow такими сниппетами переполнено
+168
<?php
...
$string = array();
...
?>
+163
//
if (delay == 0)
{
Uint8 *keys = SDL_GetKeyState(NULL);
// Checking for letters
for (c = 97; c < 123; c++)
if (cpos < 9)
if (keys[c] && !delay)
{
mapname[cpos] = c;
mapname[++cpos] = '\0';
delay = 5;
bg.show(400, 240, 0);
text.print(mapname, 200, 180);
render.backend();
break;
}
// Checking for numbers
for (c = 48; c < 58; c++)
if (cpos < 9)
if (keys[c] && !delay)
{
mapname[cpos] = c;
mapname[++cpos] = '\0';
delay = 5;
bg.show(400, 240, 0);
text.print(mapname, 200, 180);
render.backend();
break;
}
// On pressing ENTER
if (keys[13] && !delay && strlen(mapname) > 2)
break;
// On pressing BACKSPACE
if (keys[SDLK_BACKSPACE] && cpos > 0 && !delay)
{
mapname[--cpos] = '\0';
delay = 5;
bg.show(400, 240, 0);
if (cpos > 0) text.print(mapname, 200, 180);
render.backend();
}
}
if (delay > 0)
delay--;
Уверен, можно было сделать намного проще =)
+159
int** ppi = new int*;
+146
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
// man sendfile
int main (int argc, char **argv, char **envp) {
while(
(
argc < 0 // true if all ok, false on first iter
||
(
argc != 2 // true if error
&&
(printf("usage %s filename\n", argv[0]) && 0 == (argc = 0))// show error (true)
) // true if error, and argc == 0
||
(
((argc = open(argv[1], O_RDONLY) * -1) < 0) // false if error
||
(printf("cannot open %m\n") && 0 == (argc = 0))// show error (true)
)
) // true if all ok, also argc != 0
&&
(
argc < 0 // if open success this is true
&&
(read(argc * -1, memset(envp[1], 0, 1025), 1024) > 0 && printf("%s", envp[1])) || (close(argc * -1))
)
) ;
}
работает и под linux и под cygwin (gcc какие были под рукой)
затрудняюсь определить парадигму :)
+144
<html>
<head>
<TITLE>Бесплатные форумы. Дизайн phpBB, возможности vbulletin, скорость FastBB</TITLE>
<STYLE>
body {font: Verdana; }
</STYLE>
</head>
<BODY bgColor=#ffffff leftMargin=50 topMargin=5 marginheight="5" marginwidth="50" style="margin:50px;margin-top:5px;margin-bottom:5px;">
<center><br><br> <br> <br> <br> <br> <br> <br> <br>
<h1>На сервере ведутся работы. Пожалуйста, зайдите позже.</h1>
</body>
</html>
html код аварийной странички сервиса borda.ru