1. Куча / Говнокод #14373

    +127

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    % restarter.erl
    
    -module(restarter).
    % Save it to restart the node!
    
    % где-то в коде при запуске приложения
       ....
       ok = sync:go(),
       sync:onsync(fun(Mods) ->
                    case lists:member(restarter, Mods) of
                        true -> 
                            lager:warning("Restarting node!"),
                            init:restart(); 
                        _ -> ok
                    end  
                end),
       ....

    Клуб веселых и находчивых эрлангеров.
    Придумал такую фичу: если мне во время разработки надо перезапустить тестовую ноду, я просто жму сохранить в открытом файле restarter.erl
    Sync подхватывает пересохраненный файл, компилит его и вызывает коллбэк со списком измененных модулей. Собственно, если рестартер среди них, то нода перезапускается :)

    tirinox, 16 Января 2014

    Комментарии (6)
  2. PHP / Говнокод #14372

    +150

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    $up = mysql_fetch_array (mysql_query("SELECT name FROM locations WHERE id='p_".$x."_".($y-1)."_'"));
    $down = mysql_fetch_array (mysql_query("SELECT name FROM locations WHERE id='p_".$x."_".($y+1)."_'"));
    $right = mysql_fetch_array (mysql_query("SELECT name FROM locations WHERE id='p_".($x+1)."_".($y)."_'"));
    $left = mysql_fetch_array (mysql_query("SELECT name FROM locations WHERE id='p_".($x-1)."_".($y)."_'"));
    $lup = mysql_fetch_array (mysql_query("SELECT name FROM locations WHERE id='p_".($x-1)."_".($y-1)."_'"));
    $rup = mysql_fetch_array (mysql_query("SELECT name FROM locations WHERE id='p_".($x+1)."_".($y-1)."_'"));
    $rdown = mysql_fetch_array (mysql_query("SELECT name FROM locations WHERE id='p_".($x+1)."_".($y+1)."_'"));
    $ldown = mysql_fetch_array (mysql_query("SELECT name FROM locations WHERE id='p_".($x-1)."_".($y+1)."_'"));
    if (@$up["name"]) $up = 1; else $up=0;
    if (@$down["name"]) $down = 1;  else $down=0;
    if (@$right["name"]) $right = 1;  else $right=0;
    if (@$left["name"]) $left = 1; else $left=0;
    if (@$lup["name"]) $lup = 1; else $lup=0;
    if (@$rup["name"]) $rup = 1; else $rup=0;
    if (@$rdown["name"]) $rdown = 1;  else $rdown=0;
    if (@$ldown["name"]) $ldown = 1;  else $ldown=0;
    if ($_GET["go_nature"]=='up' and $up==1) $y-=1;
    if ($_GET["go_nature"]=='down' and $down==1) $y+=1;
    if ($_GET["go_nature"]=='left' and $left==1) $x-=1;
    if ($_GET["go_nature"]=='right' and $right==1) $x+=1;
    if ($_GET["go_nature"]=='lup' and $lup==1) $x-=1;
    if ($_GET["go_nature"]=='rup' and $rup==1) $x+=1;
    if ($_GET["go_nature"]=='lup' and $lup==1) $y-=1;
    if ($_GET["go_nature"]=='rup' and $rup==1) $y-=1;
    if ($_GET["go_nature"]=='rdown' and $rdown==1) $x+=1;
    if ($_GET["go_nature"]=='ldown' and $ldown==1) $x-=1;
    if ($_GET["go_nature"]=='rdown' and $rdown==1) $y+=1;
    if ($_GET["go_nature"]=='ldown' and $ldown==1) $y+=1;

    вксняшка

    SuperChel, 16 Января 2014

    Комментарии (35)
  3. Java / Говнокод #14371

    +79

    1. 1
    2. 2
    3. 3
    4. 4
    if(VovaJSONparser.ParseText(d, text))
    {
    	return d;
    }

    Вова, фас!

    arbuzz, 16 Января 2014

    Комментарии (17)
  4. Куча / Говнокод #14370

    +119

    1. 1
    "По какой-то причине не удается завершить установку вин 8.1"

    Информативное сообщение при апдейте 8.0 -> 8.1.

    bormand, 16 Января 2014

    Комментарии (269)
  5. Objective C / Говнокод #14369

    −104

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    -(BOOL) wasChanged
    {
        BOOL a,b,c,d,e,f;
        if (dueDate == nil) {
            a = (_task.dueDate == nil?YES:NO);
        }
        else
            a = [dueDate isEqualToDate:_task.dueDate];
        if (reminderTime == nil) {
            b = (_task.reminderTime == nil?YES:NO);
        }
        else
            b = [reminderTime isEqualToDate:_task.reminderTime];
        c = (importance == _task.importance?YES:NO);
        d = (reccurentType == _task.reccurentType?YES:NO);
        e = [list isEqualToString:_task.parentID];
        f = [body isEqualToString:_task.body];
        if (a && b && c && d && e && f) {
            return NO ;
        }
        return YES;
    }

    Вот такая радость в проекте..

    Jackos, 15 Января 2014

    Комментарии (25)
  6. Pascal / Говнокод #14368

    +76

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if mas[i-1,j-1]=true then begin neib[m]:=true; inc(m); end; //считаем соседей
    if mas[i-1,j]=true then begin neib[m]:=true; inc(m); end;
    if mas[i-1,j+1]=true then begin neib[m]:=true; inc(m); end;
    if mas[i,j-1]=true then begin neib[m]:=true; inc(m); end;
    if mas[i,j+1]=true then begin neib[m]:=true; inc(m); end;
    if mas[i+1,j-1]=true then begin neib[m]:=true; inc(m); end;
    if mas[i+1,j]=true then begin neib[m]:=true; inc(m); end;
    if mas[i+1,j+1]=true then begin neib[m]:=true; inc(m); end;

    Знакомый человек реализовывал «Жизнь» на делфях...

    POPSuL, 15 Января 2014

    Комментарии (75)
  7. PHP / Говнокод #14367

    +149

    1. 1
    2. 2
    3. 3
    array_unshift($available, $noSize);
    if (is_null($noSize))
        unset($available[0]);

    CRRaD, 15 Января 2014

    Комментарии (1)
  8. Си / Говнокод #14366

    +139

    1. 1
    #include "intel_glamor.h"

    Строка из драйвера видеокарты X11: intel_driver.c.
    Гламур спасёт мир.

    laMer007, 15 Января 2014

    Комментарии (131)
  9. C++ / Говнокод #14365

    +21

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    template <int N>
    void Ololo ()
    {
    	var
    		i : integer;
    	begin
    		for i := 0 to N-1 do begin
    			WriteLn(i, ' ');
    		end;
    	end;
    }
    
    int main () 
    {
    	return 0;
    }
    
    Compiling...
    Test.cpp
    Linking...
    
    Build log was saved at "file://c:\Users\TarasB\Documents\Visual Studio Projects\Test\Debug\BuildLog.htm"
    Test - 0 error(s), 0 warning(s)
    
    
    ---------------------- Done ----------------------
    
        Build: 1 succeeded, 0 failed, 0 skipped

    MSVS2003

    TarasB, 15 Января 2014

    Комментарии (37)
  10. JavaScript / Говнокод #14363

    +148

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    <div id="html-header">
    	<!--Начало этого долбаного скрипта-->
    <Sсгiрt>
    <!--
    var checkpass=''''
    tell=0
    counttimes=0
    disComp=0
    function preferences(encryptpass,encryptdepth,what,dis){
     disComp=dis
     tell=0
     tell=what
     checkpass=''''
     counttimes=0
     times=encryptdepth
     checkpass=encryptpass
     orig=''''
     this.check=mkasci
    }
    
    bases=new Array(17,33,57,101);
    var acharset=''XYZNOhijkVWHIJ45ncdefMyzopqPQRSTUABKL6789ab_rs23CDEFGlmwtuvg01x''
    var storeup='''';
    function mkasci(orig){
     if(counttimes==0){storeup=orig}
     ascival=new Array()
     for(i=0;i<=orig.length-1;i++){
     for(i1=0;i1<=acharset.length;i1++){
     if(orig.charAt(i)==acharset.charAt(i1)){ascival=i1}
     }
     }
     themeat(ascival)
    }
    function cutoff(code){
     eval("var whatcode=''"+code+"''");
     eval("var whatcode2=''"+Math.ceil(code)+"''");
     bigVal=(Math.pow(10,whatcode.length-(whatcode2.length)-2)<1)?1:Math.pow(10,whatcode.length-(whatcode2.length)-2);
     whatcode3=Math.round(code*bigVal)/bigVal
     return(whatcode3)
    }
    function themeat(basecode){
     if(basecode.length>=4){
     counttimes++
     if(disComp==1){windоw.status="Computating encryption level "+counttimes+"/"+times}
     newcode=0
     finalcode=1
     for(count=0;count!=basecode.length;count++){
     newcode=(basecode[(count<(basecode.length-1))?count+1:count-2]+(basecode[count]*bases[2])*(2.303)+basecode[Math.round(((basecode.length-1)*((Math.atan(basecode[(count!=0)?count-1:count+1])*basecode.length)+2*bases[0]))/100)]+1)
     newcode=cutoff(newcode)
     newcode=(newcode>basecode[Math.round(basecode.length/2)])?newcode-=bases[3]:newcode+=bases[3]
     finalcode=cutoff(((newcode/10)*finalcode)/(basecode.length-bases[0]))
     }
     var deconstruct=''''
     eval(''var finalcode="''+(finalcode+times)+''"'');
     for(count=0;count<finalcode.length;count++){
     if(!isNaN(finalcode.charAt(count))){
     deconstruct=deconstruct+finalcode.charAt(count)
     }
     }
     finalcode=deconstruct
     var encrypt=new Array()
     for(count=2;count<finalcode.length+2;count+=2){
     eval("encrypt["+((count/2)-1)+"]=''"+((finalcode.charAt(count-2)!=''0'')?finalcode.charAt(count-2):'''')+""+finalcode.charAt(count-1)+"''")
     encrypt[((count/2)-1)]=acharset.charAt(Math.round((acharset.length*encrypt[((count/2)-1)])/100))
     }
     encrypt=encrypt.join('''')
     if(counttimes<times){mkasci(encrypt)} else {
     counttimes=0
     if(encrypt==checkpass&&tell==0){а1егt(''OK! Password '');1осаtiоn.replace(storeup+encrypt.substring(0,5)+".html");} else {
     if(tell==1){dосиmеnt.write("<B>"+storeup+"</B> is encrypted as <B>"+encrypt+"</B>");} else {
     if(history.length>0){
     а1егt("ERROR! Password ");
     history.go(-1);
     } else {1осаtiоn.replace("err.html")}
     }
     }
     }
     } else {
     if(history.length>0){
     а1егt("ERROR! Password ");
     history.go(-1);
     } else {1осаtiоn.replace("vhod.html")}
     }
    }
    
    
    password=new preferences(''s_mkAi_Z'',15,0,1);
    var enter='''';
    while(enter.length<4){
     enter=ргоmрt(''Enter Password PAROL '','''');
     if(!enter){enter='' ''}
    }
    password.check(enter);
    </Sсгiрt>
    <!--конец этого долбаного скрипта-->
    </div>

    Гк, однако.

    Stertor, 15 Января 2014

    Комментарии (4)