- 1
- 2
- 3
var getSelectedTabName = function() {
return $('#costs-category').find('.tabs-v4-i_active').find('.tabs-v4-l').data('category_alias');
};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+153
var getSelectedTabName = function() {
return $('#costs-category').find('.tabs-v4-i_active').find('.tabs-v4-l').data('category_alias');
};
Кто-то ниасилил селекторы в jquery
+101
string indate = "01/" + ("0" + CalcActDatePicker.Value.Date.Month.ToString().Trim()).Substring(CalcActDatePicker.Value.Date.Month.ToString().Trim().Length - 1)
+ "/" + CalcActDatePicker.Value.Date.Year.ToString().Trim();
Нашел код в проекте, который передал мне уволившийся работник
+136
char *stringFromDTM(MDTM *dtm)
{
if (dtm->count < 1)
return "";
uint32_t size = (sizeof(MDTMPoint) + sizeof(uint32_t)) * dtm->count;
void *data = calloc(1, size);
uint32_t *ptr = data;
*(ptr++) = size;
uint32_t index;
for (index = 0; index < dtm->count; index++)
*(ptr++) = dtm->points[index].x;
for (index = 0; index < dtm->count; index++)
*(ptr++) = dtm->points[index].y;
for (index = 0; index < dtm->count; index++)
*(ptr++) = dtm->points[index].color;
for (index = 0; index < dtm->count; index++)
*(ptr++) = dtm->points[index].tol;
for (index = 0; index < dtm->count; index++)
*(ptr++) = dtm->points[index].size;
for (index = 0; index < dtm->count; index++)
*(ptr++) = dtm->points[index].x;
bool *bptr = (bool *)ptr;
for (index = 0; index < dtm->count; index++)
*(bptr++) = dtm->points[index].bad;
uint32_t len = compressBound(size);
char *buffer = malloc(len);
if (compress((Bytef *)buffer, (uLongf *)&len, data, size) == Z_OK)
{
free(data);
char *compressed = malloc(len + sizeof(uint32_t));
*((uint32_t *)(compressed)) = len;
strcpy(compressed + sizeof(uint32_t), buffer);
free(buffer);
}
free(buffer);
free(data);
return "";
}
Я так и не раскурил, почему так, а не иначе.
−108
__author__ = 'КотейКККин'
# Комментарий неуместен.
# О странности автора код сам все скажет.
import random
the_number = random.randint(1, 20867248)
print("Поиграем? Я загадал число от 1 до 20867248.")
print("У вас 1 попытка")
guess = int(input("Ваше предположение: "))
if guess != the_number:
print("Лошара, даже число угадать не можешь. И какой ты 'мужик' после этого...?")
else:
print(" O_O ты угадал??? По-любому вангуешь ;)")
Приобрел недавно ноутбук с рук, но чувак не почистил систему. Нашел на просторах его жестка в папках "обучение"...автор действительно имел незаурядное мышление о_О
P.S. Минусы ставьте за код, а не мне))
+159
public function asSize($value, $decimals = null, $options = [], $textOptions = [])
{
if ($value === null) {
return $this->nullDisplay;
}
list($params, $position) = $this->formatSizeNumber($value, $decimals, $options, $textOptions);
if ($this->sizeFormatBase == 1024) {
switch ($position) {
case 0: return Yii::t('yii', '{nFormatted} {n, plural, =1{byte} other{bytes}}', $params, $this->locale);
case 1: return Yii::t('yii', '{nFormatted} {n, plural, =1{kibibyte} other{kibibytes}}', $params, $this->locale);
case 2: return Yii::t('yii', '{nFormatted} {n, plural, =1{mebibyte} other{mebibytes}}', $params, $this->locale);
case 3: return Yii::t('yii', '{nFormatted} {n, plural, =1{gibibyte} other{gibibytes}}', $params, $this->locale);
case 4: return Yii::t('yii', '{nFormatted} {n, plural, =1{tebibyte} other{tebibytes}}', $params, $this->locale);
default: return Yii::t('yii', '{nFormatted} {n, plural, =1{pebibyte} other{pebibytes}}', $params, $this->locale);
}
} else {
switch ($position) {
case 0: return Yii::t('yii', '{nFormatted} {n, plural, =1{byte} other{bytes}}', $params, $this->locale);
case 1: return Yii::t('yii', '{nFormatted} {n, plural, =1{kilobyte} other{kilobytes}}', $params, $this->locale);
case 2: return Yii::t('yii', '{nFormatted} {n, plural, =1{megabyte} other{megabytes}}', $params, $this->locale);
case 3: return Yii::t('yii', '{nFormatted} {n, plural, =1{gigabyte} other{gigabytes}}', $params, $this->locale);
case 4: return Yii::t('yii', '{nFormatted} {n, plural, =1{terabyte} other{terabytes}}', $params, $this->locale);
default: return Yii::t('yii', '{nFormatted} {n, plural, =1{petabyte} other{petabytes}}', $params, $this->locale);
}
}
}
Yii продолжает свой крестовый поход против логики. Вам нужно немного другое форматирование, получить именно килобайты вместо кибибайтов? Выставьте какую-то ссаную внутреннюю переменную в значение, отличное от 1024. Да, двойка подойдет, не ссы, ставь.
−407
http://habrahabr.ru/post/244487/
Очень жаль всех этих людей, которые вынуждены писать на этом выхлопе от Apple.
"Мыши плакали, кололись, но продолжали грызть кактус."
+160
<script language=php>
use function yolo\y;
yolo\yolisp(y('yolo\yolo',
y('lambda', y('request'),
y('new', YoLo\resPONsE::clASS, y(
y('quote', 'yolo')
))
)
));
%>
Микрофреймворк будущего: https://github.com/igorw/yolo
+161
function kevinTheNumberMentioner(_){
l=[]
/* mostly harmless --> */ with(l) {
//Sorry about all this, my babel fish has a headache today...
for (ll=!+[]+!![];ll<_+(+!![]);ll++) {
lll=+!![];
while (ll%++lll);
//I've got this terrible pain in all the semicolons down my right-hand side
(ll==lll)&&push(ll);
}
forEach(alert);
}
//You're really not going to like this...
return [!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]];
}
Открыл твитор, а там - это.
http://arstechnica.com/information-technology/2014/11/holiday-reading-for-a-certain-sort-if-hemingway-wrote-javascript/
+154
<?
class user
{
function login($name, $password)
{
$name = mysql_real_escape_string($name);
$name = htmlspecialchars($name);
$password = mysql_real_escape_string($password);
$password = htmlspecialchars($password);
$sql = mysql_query("SELECT id FROM students WHERE Names='$name' AND Pass='$password'");
if (mysql_num_rows($sql) == 1)
{
$_SESSION['Name'] = $name;
return 1;
}
else
{
return 0;
}
}
Код от ТЫЖпрограммиста.
+80
procedure TInventory.removeItem(userid: integer; invid: integer;amount: integer = 1);
var
MyRes: TInvItemArray;
CurrItem: TInvItem;
I,len: integer;
begin
if (amount <= 0) then
exit;
if (amount = 1) then
begin
db.removeItemFromUserInventory(GetItems(GetIndexByInvId(invid)),userid);
FInventoryList.Remove(GetIndexByInvId(invid));
end else
begin
if (amount >= finventorylist.Size) then
exit;
MyRes:=GetResources(invid);
len:=length(myres);
if (len = 0) then
exit;
if (amount > len) then
exit;
for i:=0 to len - 1 do
begin
curritem:=MyRes[i];
db.removeItemFromUserInventory(GetItems(GetIndexByInvId(curritem.InvId)),userid);
FInventoryList.Remove(GetIndexByInvId(curritem.invid));
end;
Setlength(myres,0);
end;
end;
function TInventory.GetResources(invid: integer): TInvItemArray;
function ToResult(var Return: TInvItemArray; const Item: TInvItem): Integer;
begin
Result := Length(Return);
SetLength(Return, Result + 1);
Return[Result] := Item;
end;
var
item,sameitem: TInvItem;
Resource: TItem;
i: integer;
begin
SetLength(result,0);
item:=GetItem(invid);
if (item = nil) then
exit;
if (item.item <> nil) then
begin
// if (item.itemю = 30) then
// begin
for i:=0 to FInventoryList.Size - 1 do
begin
sameitem:=TInvItem(FInventoryList.Items[i]);
if (sameitem = nil) then
continue;
resource:=sameitem.item;
if (resource = nil) then
continue;
if (item.item.itemid = resource.itemid) then
ToResult(result,sameitem);
end;
// end;
end;
end;
По сути - удалить объект из списка. OMG!