1. Лучший говнокод

    В номинации:
    За время:
  2. Куча / Говнокод #17954

    +125

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Господа.  Помогите решить хитрую задачку.  
    Есть у меня проект корне которого лежат файлик весь проект под контролем git кроме этого файлика. там конфигурация специфичная для тестового сервера.  
    Вот мне нужно сделать еще одну ветку, и как бы сделать так что бы этот файлик был подконтрольный гиту  в этой ветке. 
    т.е. когда я делаю checkout файлик  менялся.  А когда push файлик игнорировался бы.  
    Очень буду благодарен если кто подскажет как быть.

    Vasiliy, 07 Апреля 2015

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

    +125

    1. 1
    2. 2
    3. 3
    Console.WriteLine("Say my name");
               Console.ReadLine();
               Console.WriteLine("Yes, damn right!");

    Worldoorboll, 13 Февраля 2015

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

    +125

    1. 1
    http://faculty.knox.edu/dbunde/teaching/chapel/

    Тарасу должно понравится: Паскаль со скобочками, даже begin и then есть.

    wvxvw, 15 Декабря 2014

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

    +125

    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
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    (closer-mop:defclass virtual-metaclass (closer-mop:standard-class) ())
    
    (closer-mop:defclass virtual-slot-definition
        (closer-mop:standard-slot-definition)
      ((function :initarg :function 
                 :accessor virtual-slot-definition-function)))
    
    (defmethod slot-definition-allocation ((slotd virtual-slot-definition))
      :virtual)
    
    (defmethod (setf slot-definition-allocation) 
        (allocation (slotd virtual-slot-definition))
      (unless (eq allocation :virtual)
        (error "Cannot change the allocation of a ~S"
               'virtual-direct-slot-definition)) allocation)
    
    (closer-mop:defclass virtual-direct-slot-definition 
        (closer-mop:standard-direct-slot-definition
         virtual-slot-definition) ())
    
    (defmethod closer-mop:direct-slot-definition-class
        ((class virtual-metaclass) &rest initargs)
      ;; Use virtual-direct-slot-definition if appropriate.
      (if (eq (getf initargs :allocation) :virtual)
          (find-class 'virtual-direct-slot-definition)
          (call-next-method)))
    
    (closer-mop:defclass virtual-effective-slot-definition 
        (closer-mop:standard-effective-slot-definition
         virtual-slot-definition) ())
    
    (defmethod closer-mop:effective-slot-definition-class 
        ((class virtual-metaclass) &rest initargs)
      ;; Use virtual-effective-slot-definition if appropriate.
      (let ((slot-initargs (getf initargs :initargs)))
        (if (member :virtual-slot slot-initargs)
            (find-class 'virtual-effective-slot-definition)
            (call-next-method))))
    
    (defmethod closer-mop:compute-effective-slot-definition 
        ((class virtual-metaclass) name direct-slot-definitions)
      ;; Copy the function into the effective slot definition
      ;; if appropriate.
      (let ((effective-slotd (call-next-method)))
        (dolist (slotd direct-slot-definitions)
          (when (typep slotd 'virtual-slot-definition)
            (setf (virtual-slot-definition-function effective-slotd) 
                  (virtual-slot-definition-function slotd))
            (return)))
        effective-slotd))
    
    (defmethod closer-mop:slot-value-using-class 
        ((class virtual-metaclass) object slot-name)
      (let ((slotd (find slot-name (closer-mop:class-slots class) 
                         :key 'closer-mop:slot-definition-name)))
        (if (typep slotd 'virtual-slot-definition)
            (funcall (cadr (virtual-slot-definition-function slotd)) :get object)
            (call-next-method))))
    
    (defmethod (setf closer-mop:slot-value-using-class) 
        (value (class virtual-metaclass) object slotd)
      (if (typep slotd 'virtual-slot-definition)
          ;; This is ugly and probably not portable, but what if?
          (funcall (cadr (virtual-slot-definition-function slotd))
                   :set object value)
          (call-next-method)))
    
    (defmethod closer-mop:slot-boundp-using-class 
        ((class virtual-metaclass) object slot-name)
      (let ((slotd (find slot-name (closer-mop:class-slots class) 
                         :key 'closer-mop:slot-definition-name)))
        (if (typep slotd 'virtual-slot-definition)
            (funcall (cadr (virtual-slot-definition-function slotd)) :is-set object)
            (call-next-method))))
    
    (defmethod closer-mop:slot-makunbound-using-class 
        ((class virtual-metaclass) object slot-name)
      (let ((slotd (find slot-name (closer-mop:class-slots class) 
                         :key 'closer-mop:slot-definition-name)))
        (if (typep slotd 'virtual-slot-definition)
            (funcall (virtual-slot-definition-function slotd) :unset object)
            (call-next-method))))

    О простоте объектно-ориентированого программирования, или страшная правда, которую от вас так долго скрывали.
    Написано по мотивам: http://www.lispworks.com/documentation/lw50/LWUG/html/lwuser-173.htm В попытке сделать это, по возможности, портабельным (на SBCL вроде даже завелось).

    Я понимаю, что читать это никто не будет, поэтому, краткий пересказ событий:
    Захотелось мне виртуальных свойств, ну тоесть так, чтобы при обращении к Сипипишной библиотеке, для которой я ваяю оберкту не было различий между обычными Лисповыми объектами и Сипипишными.
    Простой вариант - скопировать значения, но перформанс же!
    И вот родился этот вариант. (Использование не показано, т.как не влезло).

    wvxvw, 12 Сентября 2014

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

    +125

    1. 1
    https://users.v8.1c.ru/

    Делаем размер браузера в пол экрана, справа вверху появляется кнопочка меню.
    И правильно, нахуя править дефолтный шаблон Bootstrap.

    Cascader, 31 Июля 2014

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

    +125

    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
    // ------------------------------
    // config on all machines
    akka {
      actor {
       provider = akka.remote.RemoteActorRefProvider
       deployment {
         /greeter {
           remote = akka.tcp://MySystem@machine1:2552
         }
       }
     }
    }
     
    // ------------------------------
    // define the greeting actor and the greeting message
    case class Greeting(who: String) extends Serializable
     
    class GreetingActor extends Actor with ActorLogging {
      def receive = {
        case Greeting(who) ⇒ log.info("Hello " + who)
     }
    }
     
    // ------------------------------
    // on machine 1: empty system, target for deployment from machine 2
    val system = ActorSystem("MySystem")
     
    // ------------------------------
    // on machine 2: Remote Deployment - deploying on machine1
    val system = ActorSystem("MySystem")
    val greeter = system.actorOf(Props[GreetingActor], name = "greeter")
     
    // ------------------------------
    // on machine 3: Remote Lookup (logical home of “greeter” is machine2, remote deployment is transparent)
    val system = ActorSystem("MySystem")
    val greeter = system.actorSelection("akka.tcp://MySystem@machine2:2552/user/greeter")
    greeter ! Greeting("Sonny Rollins")

    Где найти такую же няшку под кресты?

    laMer007, 13 Июня 2014

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

    +125

    1. 1
    http://news.rambler.ru/25458110/

    Не говнокод, но хотелось бы обсудить новость. Для тех, кому лень перейти по ссылке, суть вкратце:
    создана программа, которая впервые прошла тест Тьюринга - смогла убедить более 30% судей в том, что они ведут беседу с человеком.

    Pythoner, 09 Июня 2014

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

    +125

    1. 1
    'q<->5.,q<->r<0>3.,q<T>r<0>3.,q<:>r<0>3.,q<:>r<0>3.,r<0>2.' 8!:2<.2014 3 2 3 30 46.034

    Еще одни даты на J.

    Abbath, 22 Апреля 2014

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

    +125

    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
    % -*- mode: Prolog -*-
    
    :- module e9.
    :- interface.
    :- import_module io.
    :- pred main(io::di, io::uo) is cc_multi.
    
    :- implementation.
    :- import_module int, float, list, string, math.
    
    :- func root(int) = int.
    root(Number) = floor_to_int(sqrt(float(Number))).
    
    :- func squares_under(int, int) = list(int).
    squares_under(From, To) = Result:-
        (Square = From * From,
         (if Square =< To
         then Result = [Square | squares_under(From + 1, To)]
         else Result = [])).
    
    :- pred list_to_disjunction(list(int)::in, int::out) is nondet.
    list_to_disjunction([Head | Tail], Result):-
        (Result = Head; list_to_disjunction(Tail, Result)).
    
    :- pred summands_of(list(int)::in, int::in, { int, int, int }::out) is cc_nondet.
    summands_of(Squares, Sum, { A, B, C }):-
        list_to_disjunction(Squares, As),
        list_to_disjunction(Squares, Bs),
        list_to_disjunction(Squares, Cs),
        As < Bs, Bs < Cs,
        As + Bs = Cs,
        root(As) + root(Bs) + root(Cs) = Sum,
        A = As, B = Bs, C = Cs.
    
    main(!IO):-
        Sum = 1000,
        Squares = squares_under(1, Sum * Sum),
        (if summands_of(Squares, Sum, { A, B, C })
        then io.format("Answer: A = %d, B = %d, C = %d\n", [i(A), i(B), i(C)], !IO)
        else io.format("No solutions\n", [], !IO)).

    Давно как-то мы не вспоминали Прожект Ойлер.
    Язык: Меркури,
    Эффективность решения: наверное, полный пиздец.

    Для тех, кому нечем заняться: http://joyreactor.com/post/954661

    wvxvw, 12 Апреля 2014

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

    +125

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    #include "server.h"
    
    const server::CServer s(8085, 1111);
    
    int main() {return 0;}

    http://habrahabr.ru/post/213301/
    От автора http://govnokod.ru/14526

    >И еще на мой взгляд, функция main() — атавизм, доставшийся программистам от СИ. В С++ она лишняя. Но компиляторы пока этого не знают к сожалению.
    >Но я решил «наказать» эту ненужную функцию, отобрав у нее возможность что-либо сделать — изменил файл serv.cpp следующим образом

    WGH, 21 Февраля 2014

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