-
Лучший говнокод
- В номинации:
-
- За время:
-
-
−369.1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
Процедура СформироватьТаблицуГрафика()
//Заполнение месяцев
Для НомерМесяца = 1 По 12 Цикл
НомерГода = Число(Прав(Год(ТекущаяДата()), 1));
ДатаМесяца = Дата(НомерГода, НомерМесяца, 1);
ДнейВМесяце = День(КонецМесяца(ДатаМесяца));
НоваяСтрока = КалендарьНаборЗаписей.Добавить();
НазваниеМесяца = Формат(ДатаМесяца, "ДФ=""ММММ""");
НоваяСтрока.Установить(0, НазваниеМесяца);
НоваяСтрока.НомерМесяца = НомерМесяца;
КонецЦикла;
КонецПроцедуры
Помимо дикости написанного, эта штука не работает в 2010 году.
Зарплата и Управление Персоналом 2.5.18.3
Smallrat,
12 Марта 2010
-
−116.6
- 1
- 2
- 3
- 4
- 5
class Vector
def -@
map(&:-@)
end
end
Код мой, говнокодом бы не назвал, но без улыбки точно не взглянешь на такое =)
(тут определение унарного минуса через вызов того же унарного минуса у всех элементов вектора, Кэп)
rakoth3d,
11 Марта 2010
-
+965.2
- 1
string k = Convert.ToString(s_kto.Text);
s_kto - TextBox
alex_donetsk,
03 Марта 2010
-
−155.2
- 1
%words = map { $_ => $hash{$_} } grep { !proper($_) } keys %words;
Фильтрация хэша - удаление элементов, чьи ключи не удовлетворяют некому условию.
Конечно же использование православного for для Perl-истов ниже собственного достоинства.... :X
Balza,
25 Февраля 2010
-
+72.9
- 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
public class CountUnique {
//here objects will be stored
private Object[] variants;
//temporaly array to store copying variants
private Object[] temparr;
private int total = 0;
public CountUnique() {}
public boolean test(Object obj) {
total++;
boolean hasSame = false;
if(variants == null) {
variants = new Object[1];
variants[0] = obj;
hasSame = false;
} else {
for(int i = 0; i < variants.length; i++) {
if(variants[i] == null) {} else {
if(variants[i].equals(obj)) {
hasSame = true;
break;
}
}
}
if(hasSame == false) {
temparr = variants;
variants = new Object[temparr.length+1];
for(int i = 0; i < temparr.length; i++) {
variants[i] = temparr[i];
}
variants[temparr.length] = obj;
temparr = null;
}
}
return hasSame;
}
public int unique() {
if(variants == null) {
return 0;
} else return variants.length;
}
public int total() {
return total;
}
public void free() {
variants = null;
temparr = null;
}
}
некий класс для подсчета уникальных обьектов.
особенно умиляет функция test()
danilissimus,
25 Февраля 2010
-
+159.3
- 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
var res_html = "";
for (var i = 0; i < title_section.length; i++)
{
if (title_section[i].id == sel) {
res_html += '<div class="'+prefix+'section_title" onmouseover="section_sel(this,\''+ prefix +'\')" onmouseout="section_unsel(this,\''+ prefix +'\')"' +
'onclick="section_choise(this,'+'\''+url+'\'' + ')"' +
'id='+'"'+title_section[i].id+'" '
+'style='+'"font-weight: bold"'+'>'+
'<span class="'+ prefix +'dashed_anchor">' + title_section[i].name + '</span> ';
// res_html += '(' + number_section[i] + ')';
res_html += '</div>';
}
else{
res_html += '<div class="'+prefix+'section_title" onmouseover="section_sel(this,\''+ prefix +'\')" onmouseout="section_unsel(this,\''+ prefix +'\')"' +
'onclick="section_choise(this,'+'\''+url+'\'' + ')"' +
'id='+'"'+title_section[i].id+'" '
+'>'+
'<span class="'+ prefix +'dashed_anchor">' + title_section[i].name + '</span> ';
// res_html += '(' + number_section[i] + ')';
res_html += '</div>';
}
}
document.getElementById(prefix + "sections").innerHTML += res_html;
document.getElementById(prefix + "sections").innerHTML += '<a href='+'"?id=all"'+'><div class="'+prefix+'all_sections"><img src="media/img/01/arrow.jpg" alt=""/>' +
'<span style="color:black">Все разделы</span> </div></a>';
document.getElementById(prefix + "column_sections").style.width = (max_length + 7) + "ex";
/* document.getElementById(prefix + "green_sector").style.height = (document.getElementById(prefix + "column_other").offsetHeight - 14) + "px";*/
}
Яваскрипт от местного умельца:)
HollyGeek,
18 Февраля 2010
-
+133.3
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
<target name="test-boolean">
<condition property="if-true" value="true" else="false">
<!--
Попробуйте попереключайте true / false
и посмотрите на результат - вам однозначно понравится :)
-->
<istrue value="false"/>
</condition>
<antcall target="test-boolean-true"/>
<antcall target="test-boolean-false"/>
</target>
<target name="test-boolean-true" if="if-true">
<echo>The condition evaluates to "true"</echo>
</target>
<target name="test-boolean-false" unless="if-true">
<echo>The condition evaluates to "false"</echo>
</target>
Язык - Ant, для тех, кто не в курсе. Я думаю, можно спокойно зачислить в говноязыки.
wvxvw,
18 Февраля 2010
-
+160.6
- 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
// всё ещё Wakaba Extension http://userscripts.org/scripts/review/23705
function optionValue(optionName)
{
var optionsString = (doOptionsPanel) ? get_cookie('wkExtOptions') : '';
if (optionsString == '')
{
switch (optionName)
{
case 'doQuickReply':
return doQuickReply;
break;
case 'doThreadExpansion':
return doThreadExpansion;
break;
case 'doPostExpansion':
return doPostExpansion;
break;
/*... еще 12 условий ... */
default:
return 0;
}
}
else
{
var optionsArray = optionsString.split(/,/);
switch (optionName)
{
case 'doQuickReply':
return parseInt(optionsArray[0]); // parseInt ensures that 0 is handled as an integer. lol, weak types
break;
case 'doThreadExpansion':
return parseInt(optionsArray[1]);
break;
case 'doPostExpansion':
return parseInt(optionsArray[2]);
break;
/*... еще 12 условий ... */
default:
return 0;
}
}
}
Естественно, я бы сделал это хэшами.
Но кому-то код, что выше понятнее...
function optionValue(optionName)
{
var optionsString = (doOptionsPanel) ? get_cookie('wkExtOptions') : '';
if(!optionsString){
return options[optionName]; // не установлена опция - возвращается undefined
}else{
return defaultOptions[optionName];
}
}
m1el,
14 Февраля 2010
-
+112.1
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
public IEnumerator GetEnumerator()
{
for (int CurID = 0; CurID < (controls.Count + animations.Count) / 2; CurID++)
{
KeyValuePair<Control, Animation> kvp = new KeyValuePair<Control, Animation>(controls[CurID], animations[CurID]);
yield return kvp;
}
}
Писал я код, и задумался. А когда очнулся - уже было это.
ЗЫ. controls.Count == animations.Count
psina-from-ua,
14 Февраля 2010
-
+75
- 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
import java.util.*;
public class Shell {
Shell(){
main();
}
private void main(){
boolean flag=true;
String c;
while(flag){
c=Kernel.stdin("#");
String out=exec(c);
Kernel.stdout(out);
}
}
public static String exec(String cmd){
String tmp="";
Lib_parse.line(cmd," ");
String c=Lib_parse.get(0).toLowerCase();
if(c=="help"){
tmp.concat("uname - get the OC version \n");
tmp.concat("echo - echo input phraze \n");
}
if(c=="uname"){
tmp.concat("L2ME Kernel v1.3 - Linux 2 Java ME (c) new_user \n");
}
if(c=="echo"){
tmp.concat(cmd.substring(4,cmd.length()-1)+"\n");
}
return tmp;
}
}
Правда мило? :)
Pyth_ON,
10 Февраля 2010