1. Список говнокодов пользователя Desktop

    Всего: 26

  2. Куча / Говнокод #23825

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    Whether or not you check in your Pods folder is up to you, as workflows vary from project to project. We recommend that you keep the Pods directory under source control, and don't add it to your .gitignore
    
    Benefits of checking in the Pods directory
    
        After cloning the repo, the project can immediately build and run, even without having CocoaPods installed on the machine. There is no need to run pod install, and no Internet connection is necessary.
        The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
        The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.

    https://guides.cocoapods.org/using/using-cocoapods.html

    Desktop, 25 Февраля 2018

    Комментарии (99)
  3. Objective C / Говнокод #23707

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    -(id)copyWithZone:(NSZone *)zone
    {
        NSString* str = [self toJSONString];
        
        return [[MyBeautifulClass alloc] initWithJSON:str :NO];
    }

    Desktop, 05 Февраля 2018

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

    0

    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
    mixin template IConvertible(Args...)
    {
        interface IConvertible
        {
            mixin template IConvertiblePrivate(T)
            {
            	T Convert();
            }
        
            mixin template IConvertiblePrivate(TFirst, Args...) 
            {
    	TFirst Convert();
    	mixin IConvertiblePrivate!(Args);
            }
            
            mixin IConvertiblePrivate!(Args);
        };
    }
    
    void main()
    {
       mixin IConvertible!(int, float);
       
       class Number : IConvertible 
       {
       	int Convert() { return 0; }
       	float Convert() { return 0.0; }
       };
    }

    #dlang

    В продолжение темы дженериков и шаблонов

    P.S. Проверочный код: hate

    Desktop, 06 Января 2018

    Комментарии (4)
  5. Swift / Говнокод #23638

    0

    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
    open class Converter {
        init() { }
        func convert<T, U>(from: T) -> U {
            return self.convert(from: T.self)
        }
        
        private func convert(from: MyClass1) -> MyClass2 {
            return MyClass2(value: from.value)
        }
        
        private func convert(from: MyClass2) -> MyClass1 {
            return MyClass1(value: from.value)
        }
    }
    
    let converter = Converter()
    let mC1 = MyClass1(value: 10)
    let mC2 = MyClass2(value: 30)
    
    let mc2_1: MyClass2 = converter.convert(from: mC1)
    let mc1_1: MyClass1 = converter.convert(from: mC2)

    So deep, too recursion

    Desktop, 04 Января 2018

    Комментарии (34)
  6. Objective C / Говнокод #23034

    +3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    NSString *userName = @"username";
      self.wscSession = [[[[[[[[[[[[WSCSessionBuilder create:urlString]
                                                 withConnectionDelegate:WSCSessionConnectionDelegate]
                                               withUserName:userName]
                                             withObserverDelegate:WSCSessionConnectionObserverDelegate]
                                           withPackage:[[WSCCallPackage alloc] init]]
                                         withHttpContext:httpContext]
                                       withIceServerConfig:iceServerConfig]
                                     build];
      // Open a connection to the server...
      [self.wscSession open];

    https://docs.oracle.com/cd/E55119_01/doc.71/e55126/wd_iosapps.htm#WSEWD548

    Оракл умеет в скобочки

    P.S. Зато они сделали SIP+WS+WebRTC

    Desktop, 16 Мая 2017

    Комментарии (23)
  7. JavaScript / Говнокод #22901

    −15

    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
    // ==UserScript==
    // @name         GK refine
    // @version      0.1
    // @description  opens comments on govnokod.ru... etc
    // @match        http://govnokod.ru/*
    // @match        http://www.govnokod.ru/*
    // @grant        none
    // ==/UserScript==
    
    // Показывает в стоке "new" около нового комментария
    // и пишет, сколько времени назад его оставили
    (function(){
        if(location.pathname != '/comments') return;
        
        var key = 'fcd0d66f-9ff0-4827-82f1-e183dc1ab98c-last-time';
        var lastTime = localStorage[key] ? +localStorage[key] : 0;
        var now = new Date();
        
        $('abbr.published').each(function(){
            var d = + new Date($(this).attr('title'));
            $(this).text(((now-d) / 1000 / 60).toFixed(2) + 'm');
            if(d > lastTime) $(this).after('<span style="color: red">NEW </span>');
        });
        localStorage[key] = +now;
    })();
    
    // Открывает скрытые комменты
    $("div.entry-comment-hidden").removeClass('entry-comment-hidden');
    
    // Удаляет комментарии указанных пользователей
    (function(){
        var userNames = ['AnalPunisher', 'TeaBag', 'barop', 'CrashTesterAnusov', 'guestinho', 'guestinh0']
        
        $.each(userNames, function(index, value) {
           $(".entry-comment-wrapper:contains(" + value + ")").remove();    
        });
    })();

    Небольшой фикс юзерскрипта от 1023: теперь выпиливаются комментарии юзеров из списка.

    Осталось только найти возможность возвращать к жизни заминусованные уёбками топики.

    Desktop, 04 Мая 2017

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