1. SQL / Говнокод #8624

    −108

    1. 1
    select 7-(8-datepart(weekday,getDate())) % 7

    Написал для конвертации дней недели начинающихся с SUNDAY=1, в привычные Пн-1, Вс-7

    3.14159265, 23 Ноября 2011

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

    −92

    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
    var num = 100000;
    function setArray(num){
        var arr = new Array();
        var i:Number = 0;
        for (i=0;i<num;i++){
            arr[i] = 'ytrjnjht pyfxtybt';
        }
    }// 422
    function setArray2(num){
        for (i=0;i<num;i++){
            arr[i] = 'ytrjnjht pyfxtybt';
        }
    }//562
    function setArray3(num){
        for (var i=0;i<num;i++){
            arr[i] = 'ytrjnjht pyfxtybt';
        }
    }//344
    function setArray4(num){
        var arr:Array = new Array();
        var i:Number = 0;
        for (i=0;i<num;i++){
            arr.push('ytrjnjht pyfxtybt');
        }
    }//516
    function setArray5(num){
        var arr:Array = new Array();
        for (var i=0;i<num;i++){
            arr.push('ytrjnjht pyfxtybt');
        }
    }//531
    function setArray6(num){
        for (var i=0;i<num;i++){
            arr.push('ytrjnjht pyfxtybt');
        }
    }//188
    function setArray7(num){
        arr = null;
        for (var i=0;i<num;i++){
            arr.push('ytrjnjht pyfxtybt');
        }
    }//141

    Любопытный тест производительности.

    Govnocoder#0xFF, 23 Ноября 2011

    Комментарии (5)
  3. ActionScript / Говнокод #8622

    −112

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public class BaseEntity extends Entity
    {
    public function BaseEntity()
      {
       name = 'inctanse' + _ii++ + '-' + name ? name : '';
       super();
      }
    ...
    }

    лулзы продолжаются )

    Lure Of Chaos, 23 Ноября 2011

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

    +147

    1. 1
    <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>

    Такое ещё надо придумать

    Holden, 23 Ноября 2011

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

    +168

    1. 1
    $_SESSION['lang_code'] = isset($_GET['lang_code']) ? file_exists("languages/lang_".$_GET['lang_code'].".php") ? $_GET['lang_code'] : isset($_SESSION['lang_code']) ? $_SESSION['lang_code'] : 'ru' : 'ru';

    LmSys, 23 Ноября 2011

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

    +146

    1. 1
    2. 2
    3. 3
    <a href="javascript:void(0);" onclick="suspend(8)">
    	<input type="checkbox" value="Suspend Listing" name="" id="id8">
    </a>

    ревьювил код нового джуниора, который пришёл к нам из достаточно крупной компании. Строилось через JS поэтому и запостил в JS

    mgauk, 23 Ноября 2011

    Комментарии (1)
  7. Java / Говнокод #8618

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Thread thread1 = new Thread();
    Thread thread1 = new Thread();
    thread1.start();
    thread2.start();
    while(thread1.isAlive() || thread2.isAlive()){}

    askell, 23 Ноября 2011

    Комментарии (11)
  8. Pascal / Говнокод #8617

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if c = 'y' then 
    begin 
      Writeln('Yes'); 
    end else 
    if c = 'n' then 
    begin 
      Writeln('No'); 
    end;

    Вот это кака... http://delphisources.ru/forum/showthread.php?t=19000

    Nikitiy_II, 23 Ноября 2011

    Комментарии (71)
  9. Java / Говнокод #8616

    +82

    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
    private static void createFile(File f) {
    	try {
    		f.createNewFile();
    		FileOutputStream fs = new FileOutputStream(f);
    		Long time = new Date().getTime();
    
    		int b = 0;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		b = (int) (time % 256);
    		fs.write(b);
    		time /= 256;
    
    		fs.flush();
    		fs.close();
    	} catch (IOException e) {
    		e.printStackTrace();
    	}
    }

    Сохранение даты в файл :)

    mastermind, 23 Ноября 2011

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

    +122

    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
    @SuppressWarnings("unused")
    // Sure it's used. By Guice. So stop complaining.
    protected ColQueryProvider() {
    	try {
    		// Exhibit one: ye olde dependency hell.
    		// We *should* be able to just use new EclipseCompiler(), but GWT complains
    		// in dev mode when ECJ is in the Eclipse classpath. So it's not.
    		// ECJ is still loaded by the servlet container, so this is not an issue in deployment.
    		final JavaCompiler compiler = (JavaCompiler)
    				Class.forName("org.eclipse.jdt.internal.compiler.tool.EclipseCompiler").newInstance();
    		
    		// Tweaked based on QueryEngine.DEFAULT
    		final DefaultEvaluatorFactory evaluatorFactory = new DefaultEvaluatorFactory(ColQueryTemplates.DEFAULT,
    				(URLClassLoader) DefaultEvaluatorFactory.class.getClassLoader(), compiler);
    		
    		queryEngine = new DefaultQueryEngine(evaluatorFactory);
    	} catch (final ClassNotFoundException e) {
    		throw new ProvisionException("Eclipse compiler cannot be loaded", e);
    	} catch (final InstantiationException e) {
    		throw new ProvisionException("Eclipse compiler cannot be loaded", e);
    	} catch (final IllegalAccessException e) {
    		throw new ProvisionException("Eclipse compiler cannot be loaded", e);
    	}
    }

    someone, 23 Ноября 2011

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