-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+157
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
function run()
{
var test = [60, 1, 5, 70, 8];
var biggest = 100;
var biggest_index = 0;
for (var i = 0; i < test.length; i++)
{
if (test[i] < test[i + 1])
{
biggest = test[i + 1];
test[biggest - [i + 1]] = [biggest];
}
}
test[test.length] = biggest;
}
run();
таск был найти наибольшего эллемента масива [60, 1, 5, 70, 8]; во что получилось у коллеги новобранца. это был его 20-ты опыт ;)
apostolovd,
22 Января 2015
-
+94
- 1
MenuGame extends GameMenu
jangolare,
19 Января 2015
-
+148
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
<html>
<head>
<title>Тест</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div align="center">
<h1>Задание</h1>
Написать решение c использованием ООП, которое позволяет переводить целые числа в каком-нибудь диапазоне (c миллионами включительно) в текст ( разговорный)<br>
на трех языках (рус., англ., укр.)
</div>
<form action="receivenumber.php" method="post">
<label for="textnumber">Число:</label>
<input type="number" id="textnumber" name="textnumber" required
min="-9999999" max="9999999" step="1"/><br>
<label for="selectlanguage">Выбирите язык:</label>
<select id="selectlanguage" name="selectlanguage">
<option value="eng">English</option>
<option value="ukr">Ukrainian</option>
<option value="rus" selected>Russian</option>
</select><br>
<input type="submit" name="submitnumber" value="Отправить"><br>
</form>
</body>
</html>
А это файл "index.html", который передает данные скрипту "receivenumber.php"
ppd,
23 Декабря 2014
-
+137
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
void _device_ChangeStsConnect(bool Conn)
{
switch (Conn)
{
case true: Start(); break;
case false: Stop(); break;
default: break;
}
}
"Классический" switch булевой переменной.
Qetu107,
25 Ноября 2014
-
+163
- 1
$result = $db->query("update `" . $table_prefix . "options` set `option_value`='a:2:{i:0;b:0;s:8:" . '"auto_add"' . ";a:0:{}}' where `option_name`='nav_menu_options';");
unserialize "глазами на лету" - ЛЕГКО!!!!
taras_shs,
06 Ноября 2014
-
+170
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
<form id ='activate'>
<div class ='form-control'>
<label>Введите код подтверждения из SMS</label>
<input type ='text' name ='code' class ='form-control' />
</div>
<button class = 'btn btn-success'>Активировать</button>
</form>
<script>
$(function () {
$('#activate').submit(function () {
if ($('#activate [name="code"]').val != '<?php echo $secretCode; ?>') {
alert('Вы ввели неверный код!')
return false;
}
})
})
</script>
Бог безопасности
Snickers,
15 Октября 2014
-
−115
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
ls -laF /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0
if [ "$?" -ne 0 ]; then
current_location=$PWD
gzip -dc < curl-7.22.0.tar.gz | tar -xf -
cd curl-7.22.0
./configure --prefix=/usr
make
make install
cd $current_location
else
echo "libcurl.so.4.2.0 already exist!"
fi
Ключ -f? Нет, не слышали.
codemonkey,
12 Октября 2014
-
+140
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
@foreach (var groupTest in Model.Select(t => t.TestType).Distinct())
{
<div class="form-column form-column2">
<div class="static-height">
<p class="content-subblock-title left upper-text">
<label>
@if (@groupTest.GetEnumDescription().Length < 34)
{
<text> </text>
}
@groupTest.GetEnumDescription()
</label>
</p>
@foreach (var item in Model.Where(t => t.TestType == groupTest).OrderBy(t => t.Order))
{
<div class="donation-row">
<label>@item.TestName</label>
<span class="@item.TestClass blood-test-value-don">
@item.TestValue
</span>
</div>
}
</div>
</div>
}
Я пялюсь на этот кусок вот уже полчаса...
amatenkov,
17 Сентября 2014
-
+125
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
(closer-mop:defclass virtual-metaclass (closer-mop:standard-class) ())
(closer-mop:defclass virtual-slot-definition
(closer-mop:standard-slot-definition)
((function :initarg :function
:accessor virtual-slot-definition-function)))
(defmethod slot-definition-allocation ((slotd virtual-slot-definition))
:virtual)
(defmethod (setf slot-definition-allocation)
(allocation (slotd virtual-slot-definition))
(unless (eq allocation :virtual)
(error "Cannot change the allocation of a ~S"
'virtual-direct-slot-definition)) allocation)
(closer-mop:defclass virtual-direct-slot-definition
(closer-mop:standard-direct-slot-definition
virtual-slot-definition) ())
(defmethod closer-mop:direct-slot-definition-class
((class virtual-metaclass) &rest initargs)
;; Use virtual-direct-slot-definition if appropriate.
(if (eq (getf initargs :allocation) :virtual)
(find-class 'virtual-direct-slot-definition)
(call-next-method)))
(closer-mop:defclass virtual-effective-slot-definition
(closer-mop:standard-effective-slot-definition
virtual-slot-definition) ())
(defmethod closer-mop:effective-slot-definition-class
((class virtual-metaclass) &rest initargs)
;; Use virtual-effective-slot-definition if appropriate.
(let ((slot-initargs (getf initargs :initargs)))
(if (member :virtual-slot slot-initargs)
(find-class 'virtual-effective-slot-definition)
(call-next-method))))
(defmethod closer-mop:compute-effective-slot-definition
((class virtual-metaclass) name direct-slot-definitions)
;; Copy the function into the effective slot definition
;; if appropriate.
(let ((effective-slotd (call-next-method)))
(dolist (slotd direct-slot-definitions)
(when (typep slotd 'virtual-slot-definition)
(setf (virtual-slot-definition-function effective-slotd)
(virtual-slot-definition-function slotd))
(return)))
effective-slotd))
(defmethod closer-mop:slot-value-using-class
((class virtual-metaclass) object slot-name)
(let ((slotd (find slot-name (closer-mop:class-slots class)
:key 'closer-mop:slot-definition-name)))
(if (typep slotd 'virtual-slot-definition)
(funcall (cadr (virtual-slot-definition-function slotd)) :get object)
(call-next-method))))
(defmethod (setf closer-mop:slot-value-using-class)
(value (class virtual-metaclass) object slotd)
(if (typep slotd 'virtual-slot-definition)
;; This is ugly and probably not portable, but what if?
(funcall (cadr (virtual-slot-definition-function slotd))
:set object value)
(call-next-method)))
(defmethod closer-mop:slot-boundp-using-class
((class virtual-metaclass) object slot-name)
(let ((slotd (find slot-name (closer-mop:class-slots class)
:key 'closer-mop:slot-definition-name)))
(if (typep slotd 'virtual-slot-definition)
(funcall (cadr (virtual-slot-definition-function slotd)) :is-set object)
(call-next-method))))
(defmethod closer-mop:slot-makunbound-using-class
((class virtual-metaclass) object slot-name)
(let ((slotd (find slot-name (closer-mop:class-slots class)
:key 'closer-mop:slot-definition-name)))
(if (typep slotd 'virtual-slot-definition)
(funcall (virtual-slot-definition-function slotd) :unset object)
(call-next-method))))
О простоте объектно-ориентированого программирования, или страшная правда, которую от вас так долго скрывали.
Написано по мотивам: http://www.lispworks.com/documentation/lw50/LWUG/html/lwuser-173.htm В попытке сделать это, по возможности, портабельным (на SBCL вроде даже завелось).
Я понимаю, что читать это никто не будет, поэтому, краткий пересказ событий:
Захотелось мне виртуальных свойств, ну тоесть так, чтобы при обращении к Сипипишной библиотеке, для которой я ваяю оберкту не было различий между обычными Лисповыми объектами и Сипипишными.
Простой вариант - скопировать значения, но перформанс же!
И вот родился этот вариант. (Использование не показано, т.как не влезло).
wvxvw,
12 Сентября 2014
-
+138
- 1
p.fANT = Convert.ToUInt16(((devStat & (1 << 13)) != 0 ? "1" : "0") + ((devStat & (1 << 12)) != 0 ? "1" : "0"), 2);
Вот сижу думаю так задуманно или автор сам не понял что написал
Smekalisty,
12 Сентября 2014