- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
...
XElement body = new XElement(obj.Body);
obj.HasText = body.Element("text") != null;
obj.HasPhoto = files!=null && body.Element("files");
obj.Body = new XElement(body);
...
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+109
...
XElement body = new XElement(obj.Body);
obj.HasText = body.Element("text") != null;
obj.HasPhoto = files!=null && body.Element("files");
obj.Body = new XElement(body);
...
+153
// Проверка на взлом куков
$sql2 = mysql_query("SELECT * FROM `gl_users` WHERE username = '".$_COOKIE['username']."' ");
$row = mysql_fetch_assoc($sql2);
if($_COOKIE['password'] != $row['password'] OR (isset($_COOKIE['member_id']) AND !preg_match('/^[0-9]+$/', $_COOKIE['member_id']))) {
setcookie('logined','0',time() +3600*24*30);
setcookie('member_id','',time() +3600*24*30);
setcookie('username','',time() +3600*24*30);
setcookie('password','',time() +3600*24*30);
header('Location: ?');
die();
}
Слил двиг знакомого, нашел это в конце конфига *facepalm*
+1001
p1=Vec2(cos(pi/180*mParticles[index].mRotation)*1.2f*radius,sin(pi/180*mParticles[index].mRotation)*1.2f*radius)+center+mParticles[index].mPos;
p2=Vec2(cos(pi+pi/180*mParticles[index].mRotation)*1.2f*radius,sin(pi+pi/180*mParticles[index].mRotation)*1.2f*radius)+center+mParticles[index].mPos;
DrawLine((int)p1.x,(int)p1.y,(int)p2.x,(int)p2.y);
p1=Vec2(cos(pi/2+pi/180*mParticles[index].mRotation)*1.2f*radius,sin(pi/2+pi/180*mParticles[index].mRotation)*1.2f*radius)+center+mParticles[index].mPos;
p2=Vec2(cos(3*pi/2+pi/180*mParticles[index].mRotation)*1.2f*radius,sin(3*pi/2+pi/180*mParticles[index].mRotation)*1.2f*radius)+center+mParticles[index].mPos;
DrawLine((int)p1.x,(int)p1.y,(int)p2.x,(int)p2.y);
+154
{if $active_user == '0'}
<div class="setting_problems">
<div class="number">
<span>1</span>
</div>
</div>
{/if}
{if !$shop_connect}
<div class="setting_problems" style="background-color:#ffe1b2; border-color:#ff9c01;">
<div class="number">
<span>{if $active_user == '0'}2{else}1{/if}</span>
</div>
</div>
{/if}
вывод ошибок в smarty
+155
$IN = $_REQUEST;
//trim strings
for($i = 0; $i < count($IN); $i++) {
if(is_string($IN[$i])) {
$IN[$i] = trim($IN[$i]);
}
}
кусок самопального двигла
+141
<html>
<title>NOTICE</title>
<body>
<img src="/banner.jpg"/>
</body>
</html>
megaupload.com
+166
switch ($pole['id']) {
case 0:
$result[0] = $pole[0]['user_key'];
break;
case 1:
$result[1] = $pole[1]['user_key'];
break;
...
case 99:
$result[99] = $pole[99]['user_key'];
break;
// somebody stop me.
case 100:
$result[100] = $pole[100]['user_key'];
break;
...
}
не остановили...
+956
using System;
namespace Угадай_цифру
{
class Program
{
struct IntNull
{
public static Random Rand = new Random();
public static int CompInt;
public static string UserInt;
}
public static void Main(string[] args)
{
try
{
Console.WriteLine("Игра: отгадай число.");
Console.Write("Правила игры просты, компьютер загадывает цисло от одного до 10, вы должны его отгадать.");
Console.ReadLine();
Console.Clear();
GetInt();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
public static void GetInt()
{
try
{
IntNull.CompInt = IntNull.Rand.Next(0, 10);
Console.Clear();
Console.WriteLine("Комптютер загадал число, отгадайте его");
string User = Console.ReadLine();
IntNull.UserInt = User;
Console.Clear();
GetProverka();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
public static void GetProverka()
{
try
{
if(IntNull.CompInt == Convert.ToInt32(IntNull.UserInt))
{
Console.Clear();
Console.WriteLine("Молодец, правильный ответ {0}", IntNull.CompInt);
Console.WriteLine("Нажмите Enter для продолжения");
Console.ReadLine();
GetInt();
}
else
{
Console.Clear();
Console.WriteLine("Лошара, ответ неверный, правильный ответ {0}", IntNull.CompInt);
Console.WriteLine("Нажмите Enter для продолжения");
Console.ReadLine();
GetInt();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
}
Один программист выложил на малоизвестном сайте
+150
function _unset(& $array, $n) {
$count = count($array);
if(isset($array[($n - 1)])) {
for($i = $n; $i < ($count); $i++)
unset($array[$i]);
}
}
array_slice() не в моде
+133
(require 'clsql)
(clsql:file-enable-sql-reader-syntax)
(clsql:connect
'("localhost" "database" "user" "password")
:database-type :mysql)
(defun how-many-goods-do-you-have (year month)
(declare
(type (integer 2000 2011) year)
(type (integer 1 12) month))
(clsql:select [item_id] [sale_date]
:from "table"
:where [or
[is [null [sale_date]]]
[< [sale_date]
(clsql:sql 'str_to_date\(
(format
nil
"~a-~2,'0d-00"
year month)
'|, '%Y-%m-%d')|
)]]))
Эксперименты :)