1. Ruby / Говнокод #18505

    −137

    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
    begin
          # Это пиздец
          artist_title = row.title.split(/ - /)
          if artist_title.length > 1
            row.artist = artist_title[0]
            row.title  = artist_title[1]
          else
            artist_title = row.title.split(/ — /)
            if artist_title.length > 1
              row.artist = artist_title[0]
              row.title  = artist_title[1]
            else
              artist_title = row.title.split(/ - /)
              if artist_title.length > 1
                row.artist = artist_title[0]
                row.title  = artist_title[1]
              else
                artist_title = row.title.split(/ – /)
                if artist_title.length > 1
                  row.artist = artist_title[0]
                  row.title  = artist_title[1]
                else
                  artist = row.title.match(/\((.*?)\)/)
                  artist = artist.captures[0]
                  # puts artist_title
                  # puts row.title
                  # puts artist
                  row.artist = artist
                  row.title  = row.title.gsub('('+artist+')', '').strip
                end
              end
            end
          end
        rescue
          next
        end

    gerasim13, 21 Июля 2015

    Комментарии (44)
  2. Ruby / Говнокод #18470

    −99

    1. 1
    2. 2
    3. 3
    # Напишите псевдокод который инвертирует строки, например, "abc" -> "cba"
    
    "abc".split("").reverse.join("").to_pseudocode

    Вопрос в анкете на должность Ruby-программиста

    zoer, 11 Июля 2015

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

    −114

    1. 1
    2. 2
    3. 3
    def days(index)
      ((15662003>>(2*(index-1)))&3) + 28
    end

    Вычисление количества дней в месяце по индексу.

    yuryroot, 06 Июля 2015

    Комментарии (50)
  4. Ruby / Говнокод #18350

    −119

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    def has_children_pages(id)
      unless Page.where(:parent_id => id, :public => true).blank?      
        return true
      end      
      return false
    end

    мне сказали, что этот проект php-шники писали

    Fuelen, 16 Июня 2015

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

    −103

    1. 1
    %a{href: new_user_session_path} Вход

    link_to это слишко просто

    FancyDancy, 07 Мая 2015

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

    −92

    1. 1
    errors[:please] « "fill one more field"

    Ruby On Rails. Крутяк)

    zhilinskyegor, 05 Мая 2015

    Комментарии (3)
  7. Ruby / Говнокод #17988

    −80

    1. 1
    current_time = (DateTime.parse(DateTime.now.to_s)).strftime('%d.%m.%Y %H:%M:%S')

    суровые трудовыебудни

    strax, 13 Апреля 2015

    Комментарии (841)
  8. Ruby / Говнокод #17885

    −91

    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
    def update
        error = false
        if params[:geografic].present? && ((params[:geografic] & IsoCountryCodes.all.map{|c|c.alpha2.downcase}) == params[:geografic])
          current_user.profile.geografic = params[:geografic]
        else
          error = true
          flash[:alert] ||= ''
          flash[:alert] << "Need select countries. "
        end
        begin
          current_user.profile.sectors_of_interests = Sector.find(params[:sectors_of_interests])
        rescue
          error = true
          flash[:alert] ||= ''
          flash[:alert] << 'Can not find sectors. '
        end
        if params[:profession_id].present? && profession = Profession.find(params[:profession_id])
          current_user.profile.update_attribute(:profession_id, params[:profession_id])
        else
          error = true
          flash[:alert] ||= ''
          flash[:alert] << 'Can not find profession. '
        end
        if ['cn', 'gb'].include?(params[:language_iso])
          current_user.profile.update_attribute(:country_iso, params[:language_iso])
        else
          error = true
          flash[:alert] ||= ''
          flash[:alert] << "Need select language. "
        end
        if params[:telephone].present?
          current_user.profile.update_attribute(:phone, params[:telephone])
        else
          error = true
          flash[:alert] ||= ''
          flash[:alert] << "Need input phone number. "
        end
    
        require_additional_info = (current_user.geografic.blank? || current_user.sectors_of_interests.blank? || current_user.profession.blank? || current_user.phone.blank?)
        if require_additional_info || error
          redirect_to user_path(current_user) and return
        else
          redirect_to root_path
        end
      end

    Первый раз я видел такое два года назад, думал, что за это время что-то поменялось в людях, неа. А вы говорите индусы

    Ignat_Z, 30 Марта 2015

    Комментарии (4)
  9. Ruby / Говнокод #17827

    −289

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    def self.add_zeroes(string, stringSize, leftOrRight = true)
      while string.size < stringSize
        string = leftOrRight ? "0" + string : string + "0"
      end
      string
    end

    SDK, 20 Марта 2015

    Комментарии (5)
  10. Ruby / Говнокод #17690

    −92

    1. 1
    path = Rails.env == 'development' ? '/Users/Razumovskiy/RubymineProjects/repetitor-js/' : '/var/www/apps/repetitor2-front-end/'

    eSender, 24 Февраля 2015

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