1. PHP / Говнокод #923

    +141

    1. 1
    2. 2
    chdir("D:/Inetpub/ozresort/admin");
     chdir("../");

    Модно, да?

    guest, 22 Апреля 2009

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

    +137

    1. 1
    2. 2
    3. 3
    void main(void)
    {
    }

    no comments

    guest, 22 Апреля 2009

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

    +145

    1. 1
    <?php />

    Извините, а можно сделать отдельный RSS без PHP? Количество PHP-говнокода просто зашкаливает...

    guest, 22 Апреля 2009

    Комментарии (7)
  4. C++ / Говнокод #920

    +144

    1. 1
    (unsigned int*)(&pInput->pIrStatus->PunctScheme[0])

    Индус хочет получить адрес массива PunctScheme...

    guest, 22 Апреля 2009

    Комментарии (8)
  5. JavaScript / Говнокод #919

    +150.8

    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
    f = 0;
    while (f != -1) {
    f = title.indexOf("<img ");
    if (f == -1 ) { f = title.indexOf("< img "); }
    if (f == -1 ) { f = title.indexOf("<  img "); }
    if (f == -1 ) { f = title.indexOf("<IMG "); }
    if (f == -1 ) { f = title.indexOf("< IMG "); }
    if (f == -1 ) { f = title.indexOf("<  IMG "); }
    if ( f != -1 ) {
        t = -1;
        for (i = f ; i < title.length ; i++) {
            if ( title.substr(i, 1) == ">" ) { t = i ; i = title.length; }
        }
        if (t != -1) {
            ttl = title;
            title = ttl.substring(0, f) + ttl.substring(t + 1, title.length);
        }
    }

    Индия ближе чем ты думаешь, %username%

    guest, 22 Апреля 2009

    Комментарии (0)
  6. C++ / Говнокод #918

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    void CsrSmException (void)
    {
      while(1){
        Sleep(0);
      };
    }

    Трушный индусский эксепшен :)

    guest, 22 Апреля 2009

    Комментарии (0)
  7. Python / Говнокод #917

    −102

    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
    class Node:
        def __init__(self):
    	self.id    = 0
    	self.d     = None
    	self.left  = None
    	self.right = None
        def __del__(self):
    	del self
    
    class Struct:
        def __init__(self):
    	self.data  = None
    
        def add(self,data):
    	if self.data == None:
    	    self.data		 = Node()
    	    self.data.d		 = data
    	    self.data.right	 = Struct()
    	else:
    	    if self.data.d       == data:
    		return 0
    	    elif self.data.d     != data:
    		return self.data.right.add(data)
        
        def next(self):
            if self.data != None:
    	    print self.data.d 
        	    return self.data.right.next()

    как правильно сделать чтобы при вызове next возвращалось значение не в print а в return и при рекурсия выполнялась

    guest, 22 Апреля 2009

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

    +144

    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
    switch($_POST['find'])
    	{
    		case 'a' :
    			echo '<p> Регулярный клиент.</p>';
    			break;
    		case 'b' :
    			echo '<p> Клиент, обратившийся после телефизионной рекламы.</p>';
    			break;
    		case 'c' :
    			echo '<p> Клиент, обратившийся в результате нахаождения информации в телефонном справочнике.</p>';
    			break;
    		case 'd' :
    			echo '<p> Клиент, обратившийся в результате чьей-то устной рекомендации.</p>';
    			break;
    		default :
    			echo '<p> Вы унылое говно</p>';
    			break;
    	}

    guest, 22 Апреля 2009

    Комментарии (1)
  9. JavaScript / Говнокод #915

    +147

    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
    var CanvasText = {
            /** The letters definition. It is a list of letters, 
             * with their width, and the coordinates of points compositing them.
             * The syntax for the points is : [x, y], null value means "pen up"
             */
            letters: {
                    '\n':{ width: -1, points: [] },
                    ' ': { width: 10, points: [] },
                    '!': { width: 10, points: [[5,21],[5,7],null,[5,2],[4,1],[5,0],[6,1],[5,2]] },
                    '"': { width: 16, points: [[4,21],[4,14],null,[12,21],[12,14]] },
                    '#': { width: 21, points: [[11,25],[4,-7],null,[17,25],[10,-7],null,[4,12],[18,12],null,[3,6],[17,6]] },
                    '$': { width: 20, points: [[8,25],[8,-4],null,[12,25],[12,-4],null,[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
                    '%': { width: 24, points: [[21,21],[3,0],null,[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],null,[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]] },
                    '&': { width: 26, points: [[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]] },
                    '\'':{ width: 10, points: [[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]] },
                    '(': { width: 14, points: [[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]] },
                    ')': { width: 14, points: [[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]] },
                    '*': { width: 16, points: [[8,21],[8,9],null,[3,18],[13,12],null,[13,18],[3,12]] },
                    '+': { width: 26, points: [[13,18],[13,0],null,[4,9],[22,9]] },
                    ',': { width: 10, points: [[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
                    '-': { width: 26, points: [[4,9],[22,9]] },
                    '.': { width: 10, points: [[5,2],[4,1],[5,0],[6,1],[5,2]] },
                    '/': { width: 22, points: [[20,25],[2,-7]] },
                    '0': { width: 20, points: [[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]] },
                    '1': { width: 20, points: [[6,17],[8,18],[11,21],[11,0]] },
                    '2': { width: 20, points: [[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]] },
                    '3': { width: 20, points: [[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
                    '4': { width: 20, points: [[13,21],[3,7],[18,7],null,[13,21],[13,0]] },
                    '5': { width: 20, points: [[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
                    '6': { width: 20, points: [[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]] },
                    '7': { width: 20, points: [[17,21],[7,0],null,[3,21],[17,21]] },
                    '8': { width: 20, points: [[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]] },
                    '9': { width: 20, points: [[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]] },
                    ':': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],null,[5,2],[4,1],[5,0],[6,1],[5,2]] },
                    ';': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],null,[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
                    '<': { width: 24, points: [[20,18],[4,9],[20,0]] },
                    '=': { width: 26, points: [[4,12],[22,12],null,[4,6],[22,6]] },
                    '>': { width: 24, points: [[4,18],[20,9],[4,0]] },
                    '?': { width: 18, points: [[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],null,[9,2],[8,1],[9,0],[10,1],[9,2]] },
                    '@': { width: 27, points: [[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],null,[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],null,[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],null,[19,16],[18,8],[18,6],[19,5]] },
                    'A': { width: 18, points: [[9,21],[1,0],null,[9,21],[17,0],null,[4,7],[14,7]] },
                    'B': { width: 21, points: [[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],null,[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]] },
                    'C': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]] },
                    'D': { width: 21, points: [[4,21],[4,0],null,[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]] },
                    'E': { width: 19, points: [[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11],null,[4,0],[17,0]] },
                    'F': { width: 18, points: [[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11]] },
                    'G': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],null,[13,8],[18,8]] },
                    'H': { width: 22, points: [[4,21],[4,0],null,[18,21],[18,0],null,[4,11],[18,11]] },
    
    // ...

    Нашли причину нежелания Flotr (одна из многочисленных JavaScript библиотек для генерации графиков) работать с кириллическими кодировками при отрисовке шрифтов.

    http://code.google.com/p/flotr/source/browse/trunk/flotr/flotr/prototype/lib/canvastext.js

    guest, 22 Апреля 2009

    Комментарии (0)
  10. Си / Говнокод #914

    +146

    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
    #include <stdio.h>
    #include <ctype.h>
    
    unsigned int wordsCount(const char *str);
    
    int main(int argc, char *argv[]) {
    	char *chr;
    	if(argc != 2)
    		return 255;
    
    	puts(argv[1]);
    
    	if(wordsCount(argv[1]) > 1) {
    		chr = argv[1];
    		while(*chr) {
    			if (*chr == '*')
    				*chr = '3';
    			
    			if (*chr == '+')
    				*chr = '1';
    
    			if (*chr == '-')
    				*chr = '2';
    
    			chr++;
    		}
    	}
    	puts(argv[1]);
    	
    	return 0;
    }
    
    unsigned int wordsCount(const char *str) {
    	unsigned int wordsCount = 0;
    	char isWord = 0;
    
    	while(*str) {
    		if(isalpha(*str)) {
    			isWord = 1;
    		} else if(isWord) {
    			wordsCount++;
    			isWord = 0;
    		}
    		str++;
    	}
    	
    	if(isWord)
    		wordsCount++;
    
    	return wordsCount;
    }

    guest, 21 Апреля 2009

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