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

    +130

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <h1>Регистрация нового пользователя</h1>
        <form method="post" action="reg2.php">
            <pre>Имя:            </pre><input type="text" name="name"> <br>
            <pre>Пароль:         </pre><input type="password" name="password"> <br>
            <pre>Пароль еще раз: </pre><input type="password" name="second_password"> <br> 
            <pre>E-Mail Адрес:   </pre><input type="text" name="email"> <br><br>
            <input type="submit" name="register" value="Зарегестрироваться">
        </form>

    Этот товарищ так понял популярное выражение "таблицы не нужны"? http://www.cyberforum.ru/php-database/thread939698.html

    Vladiator, 11 Сентября 2013

    Комментарии (0)
  2. Куча / Говнокод #13770

    +126

    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
    {if $main eq "home"}
    	{include file="main.tpl"}
    {elseif $main eq "404"}
    	{include file="404.tpl"}
    {elseif $main eq "category"}
    	{include file="category.tpl"}
    {elseif $main eq "object"}
    	{include file="object.tpl"}
    {elseif $main eq "object_har"}
    	{include file="object_har.tpl"}    
    {elseif $main eq "review"}
    	{include file="review.tpl"}
    {elseif $main eq "search"}
    	{include file="search.tpl"}
    {elseif $main eq "search_alphabet"}
    	{include file="search_alphabet.tpl"}	
    {elseif $main eq "reviews"}
    	{include file="reviews.tpl"}	
    {elseif $main eq "best_objects"}
    	{include file="best_objects.tpl"}	
    {elseif $main eq "add_review"}
    	{include file="add_review.tpl"}	
    {elseif $main eq "new_review"}
    	{include file="new_review.tpl"}	
    {elseif $main eq "add_object"}
    	{include file="add_object.tpl"}	
    {elseif $main eq "register"}
    	{include file="register.tpl"}	
    {elseif $main eq "profile"}
    	{include file="profile.tpl"}	
    {elseif $main eq "profile_edit"}
    	{include file="profile_edit.tpl"}	
    {elseif $main eq "page"}
    	{include file="page.tpl"}	
    {/if}

    smarty

    и такое попадается

    slvABTOP, 11 Сентября 2013

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

    +121

    1. 1
    #include "commode.h"

    //development might be long and harassing
    //we'll need some furniture to keep food and coffee

    ckopo, 06 Сентября 2013

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

    +131

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <td>
    						<select class="form-control" ng-model="contact.type">
    							<option value="meat">Работоспособный</option>
    							<option value="children">Ребенок</option>
    							<option value="cripple">Пенсионер</option>
    							<option value="cripple">Инвалид</option>
    						</select>
    					</td>

    дети цветы жизни. остальные - мясо и калеки

    rombik, 03 Сентября 2013

    Комментарии (16)
  5. Куча / Говнокод #13725

    +119

    1. 1
    2. 2
    /proc/add_action(source, action, param1, param2)
    	toExecute += list(source = source, procname = ( action = "attack" ? "attack" : ( action = "move" ? "move" : ( action = "..." ? "someshit1" : ( action = "...(2)" ? "someshit2" : null ) ) ) ), params = list( ( (action = "attack") or (action = "move") ? param1 : null), (action = "..." or action = "...(2)" ? param2 : null ) )

    А я люблю обмазываться несвежим кодом в одну строку и дрочить.

    Сам код - лишь пример, но его можно расширять бесконечно.

    EditorRUS, 02 Сентября 2013

    Комментарии (5)
  6. Куча / Говнокод #13711

    +135

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    BoxOfIndex =[0,0,0,1,1,1,2,2,2,0,0,0,1,1,1,2,2,2,0,0,0,1,1,1,2,2,2,
                           3,3,3,4,4,4,5,5,5,3,3,3,4,4,4,5,5,5,3,3,3,4,4,4,5,5,5,
                           6,6,6,7,7,7,8,8,8,6,6,6,7,7,7,8,8,8,6,6,6,7,7,7,8,8,8]
    
    Box = BoxOfIndex[i*9 +j]

    Определение индекса малого квадрата в судоку

    Вместо
    Box = (i/3)*3 +j/3

    kegdan, 01 Сентября 2013

    Комментарии (21)
  7. Куча / Говнокод #13702

    +141

    1. 1
    2. 2
    Хаскелисты против Сионистов:
    http://trollingnews.com/

    USB, 29 Августа 2013

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

    +125

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    fn AsText Val BufferID:undefined AppendLast:false Prefix:"" Postfix:"" ArraySeparators:#("#(", ",", ")") ValClass:undefined AncestorName:undefined PushVar:undefined = (
    	if PushVar == undefined then PushVar = GIMS.Core.BufferMgr.PushVar
    	case (ClassOf Val) of (
    		ArrayParameter:
    			AsText Val BufferID:BufferID AppendLast:AppendLast Prefix:Prefix Postfix:Postfix ArraySeparators:ArraySeparators ValClass:Array AncestorName:AncestorName PushVar:PushVar
    		Array: (
    			if BufferID != undefined then (
    				PushVar BufferID (Prefix + ArraySeparators[1]) AppendLast:AppendLast
    				for ItemID = 1 to Val.Count do (
    					if ItemID != Val.Count then
    						AsText Val[ItemID] BufferID:BufferID AppendLast:AppendLast Postfix:ArraySeparators[2] AncestorName:AncestorName PushVar:PushVar
    					else
    						AsText Val[ItemID] BufferID:BufferID AppendLast:AppendLast AncestorName:AncestorName PushVar:PushVar
    				)
    				PushVar BufferID (ArraySeparators[3] + Postfix) AppendLast:AppendLast
    			) else (
    				local	Res = (Prefix + ArraySeparators[1])
    				for ItemID = 1 to Val.Count do (
    					if ItemID != Val.Count then
    						Res += (AsText Val[ItemID] Postfix:ArraySeparators[2] AncestorName:AncestorName PushVar:PushVar)
    					else
    						Res += (AsText Val[ItemID] AncestorName:AncestorName PushVar:PushVar)
    				)
    				Res += (ArraySeparators[3] + Postfix)
    			)
    			Res
    		)
    		String: (
    			if BufferID != undefined then
    				PushVar BufferID (Prefix + "\"" + (GIMS.Core.StringOps.ReplaceChars Val ReplaceTags:#(#("\"", "\\"), #("\\\"", "\\\\")) MultiChar:true) + "\"" + Postfix) AppendLast:AppendLast
    			else
    				(Prefix + "\"" + (GIMS.Core.StringOps.ReplaceChars Val ReplaceTags:#(#("\"", "\\"), #("\\\"", "\\\\")) MultiChar:true) + "\"" + Postfix)
    		)
    		Name: (
    			if BufferID != undefined then
    				PushVar BufferID (Prefix + "#" + Val as string + Postfix) AppendLast:AppendLast
    			else
    				(Prefix + "#" + Val as string + Postfix)
    		)
    		BitmapTexture: (
    			GIMS.Core.MaterialOps.FixTexName Val
    			local	FileName = (GetFileNameFile Val.FileName)
    			if BufferID != undefined then (
    				if (DoesFileExist Val.FileName) then (
    					local	FilePath = (GIMS.CurrentGame.ResourceCachePath + AncestorName + "/")
    					MakeDir FilePath All:true
    					CopyFile Val.FileName (FilePath + (FileNameFromPath Val.FileName))
    				)
    				PushVar BufferID (Prefix + "(GIMS.Core.MaterialOps.CreateBitmapFile (GIMS.CurrentGame.ResourceCachePath + \"" + AncestorName + "/\") \"" + FileName + "\")" + Postfix) AppendLast:AppendLast
    			) else
    				(Prefix + "(GIMS.Core.MaterialOps.CreateBitmapFile \"" + (GetFileNamePath Val.FileName) + "\" \"" + FileName + "\")" + Postfix)
    		)
    		default: (
    			local	VarType = (SuperClassOf Val)
    			if VarType == StructDef or VarType == GeometryClass or VarType == Material then (
    				if BufferID == undefined then
    					throw "Undefined BufferID!"
    				local	AllTagNames = (GetPropNames Val),
    						StructNameTagID = (FindItem AllTagNames #StructName),
    						StructName = (
    						if StructNameTagID != 0 then
    							(GetProperty Val AllTagNames[StructNameTagID])
    						else
    							((ClassOf Val) as string)
    						),
    						Tags = (
    							for TempTag in AllTagNames where
    								TempTag != #StructName and
    								not (IsKindOf (GetProperty Val TempTag) MAXScriptFunction)
    							collect
    								TempTag
    						)
    				if Tags.Count == 1 then
    					PushVar BufferID (Prefix + "(" + StructName + "())") AppendLast:AppendLast
    				else (
    					PushVar BufferID (Prefix + "(") AppendLast:AppendLast
    					PushVar BufferID (StructName + " \\") AppendLast:AppendLast
    					case VarType of (
    						GeometryClass: (
    							PushVar BufferID ("Name:" + (AsText Val.Name AncestorName:AncestorName PushVar:PushVar) + " \\") AppendLast:AppendLast
    							PushVar BufferID ("Pos:" + Val.Pos as string + " \\") AppendLast:AppendLast
    						)
    						Material: (
    							PushVar BufferID ("Name:" + (AsText Val.Name AncestorName:AncestorName PushVar:PushVar) + " \\") AppendLast:AppendLast
    							PushVar BufferID ("ShowInViewPort:" + Val.ShowInViewPort as string + " \\") AppendLast:AppendLast
    						)
    					)
    					for TagID = 1 to Tags.Count do
    						AsText (GetProperty Val Tags[TagID]) BufferID:BufferID AppendLast:AppendLast Prefix:(Tags[TagID] as String + ":") Postfix:" \\" AncestorName:AncestorName PushVar:PushVar
    					PushVar BufferID (")" + Postfix) AppendLast:AppendLast
    				)
    			) else (
    				if BufferID != undefined then
    					PushVar BufferID (Prefix + Val as string + Postfix) AppendLast:AppendLast
    				else
    					(Prefix + Val as string + Postfix)
    			)
    		)
    	)
    )

    MAXScript. Сериализация от бога!

    3Doomer, 29 Августа 2013

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

    +134

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    private static final String IPADDRESS_PATTERN =  
    "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + 
    "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + 
    "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + 
    "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";

    Сначала статья по регуляркам, а потом хороший, годный пример для ip)

    kegdan, 28 Августа 2013

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

    +126

    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
    import Data.Char
    import Data.List
    
    digitRangeToRegex :: Integer -> Integer -> String
    digitRangeToRegex min max
        | min == max = digit min : ""
    -- uncomment if you want \d instead of [0-9]
    --    | min == 0 && max == 9 = "\\d"
        | min >= 10 || max <= 9 = "[" ++ rangeToStr (digit min) (digit max) ++ "]"
        | otherwise = "[" ++ rangeToStr (digit min) '9' ++ rangeToStr 'a' (digit max) ++ "]"
        where
            rangeToStr min max
                | min == max = min : ""
                | otherwise = min : '-' : max : ""
            digit d
                | d >= 0 && d <= 9 = chr (ord '0' + fromIntegral d)
                | d < 36 = chr (ord 'a' + fromIntegral d - 10)
    
    numberRangeToRegex :: Integer -> Integer -> Integer -> String
    numberRangeToRegex base min max
        | min == 0 && max == 0 = "0"
        | cmin == cmax = intercalate "|" $ map formatRanges $ step dmin dmax
        | otherwise = intercalate "|" $
            (map formatRanges $ step dmin (replicate cmin (base-1))) ++
            (if cmin + 1 < cmax then [digitRangeToRegex 1 (base - 1) ++ digitRangeToRegex 0 (base-1) ++ formatCount cmin (cmax-2)] else []) ++
            (map formatRanges $ step (1 : replicate (cmax-1) 0) dmax)
        where
            digits 0 = [0]
            digits n = reverse $ map (`mod` base) $ takeWhile (>0) $ iterate (`div` base) n
            dmin = digits min
            dmax = digits max
            cmin = length dmin
            cmax = length dmax
            step [] [] = [[]]
            step (a:as) (b:bs) =
                if a == b then
                    prepend a $ step as bs
                else
                    (if zeroHead then [] else prepend a $ step as nines) ++
                    (if na > nb then [] else [(na, nb) : replicate (length as) (0, base-1)]) ++
                    (if nineTail then [] else prepend b $ step zeros bs)
                where
                    suffixLen = length as
                    zeroHead = all (== 0) as
                    nineTail = all (== base-1) bs
                    na = if zeroHead then a else a+1
                    nb = if nineTail then b else b-1
                    zeros = replicate suffixLen 0
                    nines = replicate suffixLen (base-1)
                    prepend x = map ((x, x):)
            formatRanges = concatMap formatGroup . group . dropWhile (== (0,0)) where
                formatGroup [(min, max)] = digitRangeToRegex min max
                formatGroup xs@((min, max) : _)
                    | min == max = concat $ replicate (length xs) $ digitRangeToRegex min max
                    | otherwise = digitRangeToRegex min max ++ "{" ++ show (length xs) ++ "}"
            formatCount min max
                | min == 1 && max == 1 = ""
                | min == max = "{" ++ show min ++ "}"
                | otherwise = "{" ++ show min ++ "," ++ show max ++ "}"

    Генератор реджексов, проверяющих диапазон чисел. Говнецо то еще, причем не только в реализации и выхлопе, но и в самой идее :)

    Пример: http://ideone.com/FzAmYd

    bormand, 27 Августа 2013

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