- 
        
Список говнокодов пользователя someone
        Всего: 116
     
        - 
        
        
                +118        
        
                            - 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 
                        import static com.google.gwt.query.client.GQuery.*;
import com.google.gwt.query.client.Function;
public void onModuleLoad() {
  //Hide the text and set the width and append an h1 element
  $("#text").hide()
    .css("width", "400px")
    .prepend("<h1>GwtQuery Rocks !</h1>");
    
    //add a click handler on the button
    $("button").click(new Function(){
      public void f() {
        //display the text with effects and animate its background color
        $("#text").as(Effects)
          .clipDown()
          .animate("backgroundColor: 'yellow'", 500)
          .delay(1000)
          .animate("backgroundColor: '#fff'", 1500);
      }
    });
}
                                     
        
            Не ГК, но мне показалось забавно.
https://code.google.com/p/gwtquery/
        
        
            
 someone,
            25 Сентября 2014
        
        
        
             - 
        
        
                +127        
        
                            - 1
 
                        ['10','10','10','10'].map(parseInt)
                                     
        
            Результат:
[10, NaN, 2, 3]
        
        
            
 someone,
            22 Сентября 2014
        
        
        
             - 
        
        
                −119        
        
                            - 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 
                        import sys;
 
class Cout(object):
    def __lshift__(self, anything):
        sys.stdout.write(str(anything));
        return self;
 
cout = Cout();
endl = '\n';
 
cout << 'Hello, World!' << endl;
                                     
        
            http://lurkmore.to/Обсуждение:Python#.D0.92_.D1.81.D1.82.D0  .B8.D0.BB.D0.B5_.D0.BF.D0.BB.D1.8E.D1.81  .D0.BE.D0.B2
        
        
            
 someone,
            11 Сентября 2014
        
        
        
             - 
        
        
                +118        
        
                            - 1
 
                        protected static final float PI_2 = (float)(Math.PI / 2.0);
                                     
        
            
        
        
            
 someone,
            09 Сентября 2014
        
        
        
             - 
        
        
                +124        
        
                            - 1
 - 2
 
                        // poor man's semaphore
while (self.fetching) {}
                                     
        
            http://backgridjs.com/ref/extensions/select2-cell.html
        
        
            
 someone,
            01 Сентября 2014
        
        
        
             - 
        
        
                +134        
        
                            - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 
                        if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
    goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
    goto fail;
    goto fail;
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
    goto fail;
                                     
        
            https://www.imperialviolet.org/2014/02/22/applebug.html
Понятно, что третий if не выполнится. Кстати, это был баг в Apple SSL/TLS, привёдший к уязвимости.
Кстати, GCC с -Wall это не ловит. Ловит только Clang, и то только с -Wunreachable-code. Мораль: заключайте все тела ифов в блоки!
        
        
            
 someone,
            28 Августа 2014
        
        
        
             - 
        
        
                +121        
        
                            - 1
 - 2
 - 3
 
                        long longVariable = <...>;
...
double doubleVariable = new Double(longVariable).doubleValue();
                                     
        
            Вот так делается по ВСЕМУ проекту, когда нужно перевести long в double.
        
        
            
 someone,
            25 Августа 2014
        
        
        
             - 
        
        
                +118        
        
                            - 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
 
                        if (operator instanceof TUOperatorStacker) {
	dump.put("operator_type", "TUOperatorStacker");
} else if (operator instanceof TUOperatorDestacker) {
	dump.put("operator_type", "TUOperatorDestacker");
} else if (operator instanceof TUOperatorTargetedStacker) {
	dump.put("operator_type", "TUOperatorTargetedStacker");
} else if (operator instanceof TUOperatorTargetedDestacker) {
	dump.put("operator_type", "TUOperatorTargetedDestacker");
}
<...>
String typeString = (String) dump.get("operator_type");
TUOperator operator = null;
if (typeString.equals("TUOperatorStacker")) {
	operator = new TUOperatorStacker(simElement);
} else if (typeString.equals("TUOperatorDestacker")) {
	operator = new TUOperatorDestacker(simElement);
} else if (typeString.equals("TUOperatorTargetedStacker")) {
	operator = new TUOperatorTargetedStacker(simElement);
} else if (typeString.equals("TUOperatorTargetedDestacker")) {
	operator = new TUOperatorTargetedDestacker(simElement);
}
                                     
        
            
        
        
            
 someone,
            18 Августа 2014
        
        
        
             - 
        
        
                +121        
        
                            - 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 
                        class Program
{
	static int x = 0;
	
	static int f()
	{
	x = x + 10;
		return 1;
	}
	
	public static void Main()
	{
		x += f();
		System.Console.WriteLine(x);
	}
}
                                     
        
            Следите за руками! Чему же в итоге равно x?
Проверить себя: http://ideone.com/v8rktM
Источник: http://blogs.msdn.com/b/oldnewthing/archive/2014/08/14/10549885.aspx
        
        
            
 someone,
            15 Августа 2014
        
        
        
             - 
        
        
                +122        
        
                            - 1
 - 2
 - 3
 
                        protected SimulationElement getThis(){
	return this;
}
                                     
        
            
        
        
            
 someone,
            08 Августа 2014