- 1
if [ "$PROJECTVERSION" -gt "1.1.0" ; then
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−126
if [ "$PROJECTVERSION" -gt "1.1.0" ; then
Именно в таком виде найдено в проходящих письмах коммитницы.
−172
UTF8 = {
encode: function(str){
for(var c:String, i:Number = -1, l:Number = (str = str.split("")).length, o:Function = String.fromCharCode; ++i < l;
str[i] = (c = str[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : str[i]
);
return str.join("");
},
decode: function(str){
for(var a:Array, b:Array, i:Number = -1, l:Number = (str = str.split("")).length, o:Function = String.fromCharCode, c:String = "charCodeAt"; ++i < l;
((a = str[i][c](0)) & 0x80) &&
(str[i] = (a & 0xfc) == 0xc0 && ((b = str[i + 1][c](0)) & 0xc0) == 0x80 ?
o(((a & 0x03) << 6) + (b & 0x3f)) : o(128), str[++i] = "")
);
return str.join("");
}
};
Это чудо народного зодчества было предложено в качестве конвертора из ASCII в UTF8 и обратно. Проблема осложняется тем, что человек так делает в полной уверенности, что он что-то соптимизировал. (Ну и конечно, китайцы со своими иероглифами, как всегда в пролете, а так же французы со своими диакритиками, поляки, немцы и т.д.). То что страдает типизация и инкапсуляция, просто меркнет перед форматированием и полным отсутствием здравого смысла.
http://www.kirupa.com/forum/showthread.php?t=351816
+157
$wpdb->query($wpdb->prepare("INSERT INTO `".WPSC_TABLE_CART_CONTENTS."` (`prodid`, `name`, `purchaseid`, `price`, `pnp`,`tax_charged`, `gst`, `quantity`, `donation`, `no_shipping`, `custom_message`, `files`, `meta`) VALUES ('%d', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '0', '%s', '%s', NULL)", $this->product_id, $this->product_name, $purchase_log_id, $this->unit_price, (float)$shipping, (float)$tax, (float)$tax_rate, $this->quantity, $this->is_donation, $this->custom_message, serialize($this->custom_file)));
$cart_id = $wpdb->get_var("SELECT LAST_INSERT_ID() AS `id` FROM `".WPSC_TABLE_CART_CONTENTS."` LIMIT 1");
Это код WP-Ecommerce. Ахтунг!
+105
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace GisClient
{
class EntryPoint
{
static void Main()
{
TcpClient TcpCli = new TcpClient("127.0.0.1", 15800);
NetworkStream ns = TcpCli.GetStream();
PacketStructure obj = new PacketStructure();
obj.CommandOptions = 0x80; //What's this shit??? 0x80 , what's Encoding??? What 0x80 equals to?
obj.Write2Net(ns);
obj.ReadFromNet(ns);
}
}
class PacketStructure
{
UInt32 PacketId = 0x35534947;
Guid UserId = new Guid();
public byte CommandOptions = 0;
UInt32 CommandSize = 0;
byte[] Reserved = new byte[3];
public void Write2BufferStream(MemoryStream ms)
{
//PacketId || Length - 4 || Type - UInt32
ms.Write(BitConverter.GetBytes(PacketId), 0, 4);
//UserId || Length - 16 || Type - byte[16]
ms.Write(UserId.ToByteArray(), 0, 16);
//Command Options || Length - 1 || byte
ms.Write(BitConverter.GetBytes(CommandOptions), 0, 1);
//Command Size || Length - 4 || Int32
ms.Write(BitConverter.GetBytes(CommandSize), 0, 4);
//Reserved space || Length - 3 || byte[3]
ms.Write(Reserved, 0, 3);
//CRC32 - control summary
ms.Write(BitConverter.GetBytes(CRC32.BytesCrc(ms.ToArray())), 0, 4);
}
public void Write2Net(NetworkStream ns)
{
MemoryStream ms = new MemoryStream();
Write2BufferStream(ms);
byte[] A = ms.ToArray();
ns.Write(A, 0, (int)ns.Length);
}
public void ReadFromNet(NetworkStream ns)
{
byte[] B = new byte[32];
ns.Read(B, 0, (int)ns.Length);
PacketId = BitConverter.ToUInt32(B, 0); //??????? lolwhat?????!!!!!111
byte[] C = new byte[16];
for (int i = 0; i < 16; i++)
{
C[i] = C[i + 4];
}
foreach (int i in C)
{
Console.WriteLine(i);
Console.ReadLine();
}
UserId = new Guid(C);
CommandOptions = B[20]; // Why no BitConverter?????!!!!!
CommandSize = BitConverter.ToUInt32(B, 21); // The end of CommandSize IS NOT SET!!!!1111
for (int i = 0; i < 3; i++) Reserved[i] = B[i + 25]; // A[0] = Packet[0 + 25] IF i = 0 THEN i++
Console.ReadLine();
}
}
}
Код с работы, вот так вот мы отслыаем и принимаем пакеты по TCP.
Комменатрии особенно доставляют удовольствие :)
+144
$a = true || false;
^)
−146
for section in config.sections():
GROUP_PREFIX = 'group '
if not section.startswith(GROUP_PREFIX):
continue
group = section[len(GROUP_PREFIX):]
if group in seen:
continue
из проекта gitosis
+149
<?
$txt_file=("logins.txt");
preg_match( "/value='(.*)'/", file_get_contents("http://login.vk.com/?act=login&[email protected]&pass=asdasd&expire=&vk="), $null );
foreach(file($txt_file) as $account)
{
$data=explode(':',$account);
$qwe = file_get_contents('http://login.vk.com/?act=login&email='.urlencode($data[0]).'&pass='.urlencode($data[1]).'&expire=&vk=');
if($qwe == $null){
print "".$data[0].":".$data[1]." not valid</br>";
}else{
print "".$data[0].":".$data[1]." are valid</br>";
}
}
?>
checker
+167
#define ItemType char
#define SecondItemType unsigned
class Doubler
{
ItemType _i1_;
SecondItemType _i2_;
//...
//Дальше идёт много функций класса, использующие ItemType и SecondItemType.
//...
};
+155
<!DOCTYPE html>
<html>
<head>
<style>
*{ margin: 0; padding: 0; }
html,body{
height: 300px;
width: 100%;
border: 1px solid #C0C0C0;
}
</style>
</head>
<body>
<table height=100%>
<tr>
<td><div style="border: 1px solid green;">fasdfadsf<br />fasdfadsf<br />fasdfadsf<br />fasdfadsf<br /></div></td>
</tr>
<tr height=100%>
<td height=100%><div style="height:100%; border: 1px solid red;">fadsfadsfasd</div></td>
</tr>
</table>
<!--
<div style="height: 100%; border: 1px solid blue; ">
<div style="border: 1px solid green;">fasdfadsf<br />fasdfadsf<br />fasdfadsf<br />fasdfadsf<br /></div>
<div style="height:100%; border: 1px solid red;">fadsfadsfasd</div>
</div>
-->
</body>
</html>
в IE выходит за границы которые заданны в body.
+158
for (int i = 0; i < m_pTableWidget->rowCount(); i++) {
m_pFilterList->addFilter(m_pTableWidget->item(i, 0)->text(),
(qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 1)))->currentText(),
(qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 2)))->itemData((qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 2)))->currentIndex()).toString(),
m_pTableWidget->item(i, 3)->text(),
(qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 4)))->itemData((qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 4)))->currentIndex()).toString(),
((qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 2)))->currentText().contains("конца") ? "'%" : (qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 2)))->currentText().contains("любой") ? "'%" : "'"),
((qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 2)))->currentText().contains("начала") ? "%'" : (qobject_cast<QComboBox*>(m_pTableWidget->cellWidget(i, 2)))->currentText().contains("любой") ? "'%" : "'")
);
}
Вот так вот брутально выглядит код "в одну строчку"