Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Arun Kumar Mohan
    @arku

    the word

    AFAIK, bang methods in ruby mutate the object and never return them like the non-bang ones

    L. P. Soai-Van
    @leosoaivan
    mutate and return would be nice
    minor complaint
    Tim Dowd
    @timothydowd
    Hi. Im doing the hangman project where you load a txt file and the ruby program randomly picks a word from the text file to use as the hangman word. The word has to be between 5 and 12 letters... Problem I am having is that when I use string.length it returns the length of the string + 2... Any idea why this is happening?
    def gen_rand_word
        dic_array = []
    
        lines = File.readlines "5desk.txt"
        lines.each do |word|
          dic_array.push(word)
        end
    
        rand_no = rand(0..dic_array.length-1) #creates rand number within array index length
        rand_word = dic_array[rand_no] #chooses random word from random number
        rand_word_length = rand_word.length-2 #counts length of random word.
    
        until rand_word_length > 4 && rand_word_length < 13 # checks rand word is between 5 and 12 letters
          rand_no = rand(0..dic_array.length-1)
          rand_word = dic_array[rand_no]
          rand_word_length = rand_word.length-2
        end
    
        puts rand_no
        puts rand_word
        puts rand_word.length-2
      end
    as you can see I have subtracted 2 from the length to compensate for this issue however would be nice to fix from the root rather than this workaround i am currently using
    Javier M
    @Javier-Machin
    try rand_word.strip.length
    that will remove trailing and leading spaces
    Tim Dowd
    @timothydowd
    ahh is that what it is
    ok thanks will try
    Javier M
    @Javier-Machin
    might be it
    Tim Dowd
    @timothydowd
    thats it
    @Javier-Machin ++
    KonKdev
    @KonKdev
    to Start ruby I must set up linux operating system?
    L. P. Soai-Van
    @leosoaivan
    mac or linux are best for Ruby and Ruby on Rails
    a VM is a relatively good/easy/safe option
    KonKdev
    @KonKdev
    will become my system become slower?
    Briggs Elsperger
    @I3uckwheat
    @KonKdev Only if the VM is running
    KonKdev
    @KonKdev
    after odin project i could find a remote job as developer?
    Tommy Hoang
    @hoangtommy
    @KonKdev I think you'll be in a good position to apply for jobs, not sure what landscape is like for remote work. A lot of the guys here who have jobs would be able to shed more light
    Briggs Elsperger
    @I3uckwheat
    @KonKdev It will give you a strong base as a developer for sure. Getting a remote job is about how you sell yourself. Do a lot of open source work and asynchronous collaborating and you have a good chance
    KonKdev
    @KonKdev
    Thank you very much for your answers and your time.Could you tell me more about open source work and asynchronous collaborating?from where can I start?@l3uckwheat
    Briggs Elsperger
    @I3uckwheat

    @KonKdev Open source work is just contributing to projects of which are open source. Like The Odin Project.

    and asynchronous collaborating is just working on code with others that aren't in the same room

    You need to know how to code first though
    KonKdev
    @KonKdev
    Virtual machine and unbuntu can be harmful for my pc?
    hard disk ssd?
    Briggs Elsperger
    @I3uckwheat
    @KonKdev What are you exactly asking?
    KonKdev
    @KonKdev
    To lose my files, spoil the hard drive anything that can affect the pc.@l3uckwheat
    Briggs Elsperger
    @I3uckwheat
    Not really. I mean it'll read and write to the disk, but it's nothing to really worry about too much
    KonKdev
    @KonKdev
    Can i set up ruby on rails in windows 10? @I3uckwheat
    Briggs Elsperger
    @I3uckwheat

    with WSL yeah, but you'll probably have a harder time with that.

    You're best option is a Virtual Machine with xubuntu

    KonKdev
    @KonKdev
    What actually means it'll read and write to the disk? Also i'll want to ask you if you know another tutorial for javascript? @I3uckwheat
    Briggs Elsperger
    @I3uckwheat
    It'll do what an OS does normally
    It'll be fine with a VM
    we've had many people use them and not one has had an issue with the host OS
    a VM is like a program that runs another OS
    This is the best JS tutorial I know
    @KonKdev
    KonKdev
    @KonKdev
    Thanks! @I3uckwheat
    Briggs Elsperger
    @I3uckwheat
    :+1:
    KonKdev
    @KonKdev
    @I3uckwheat I would like to ask if you know if it's possible to do an internship like a remote web developer?if there are companies that do it.
    Briggs Elsperger
    @I3uckwheat
    @KonKdev I've not heard of one, nor seen one. But I'm sure somewhere does
    Julien Gracia
    @mothinx
    The rspec's cursus told me to take a brake and come here. So here am i. Hello word !
    L. P. Soai-Van
    @leosoaivan
    @mothinx :wave:
    Joe Himes
    @deedle42
    So I am having a bitch of a time with this whole remember thing in the members-only project for authentication.
    class User < ApplicationRecord
      before_create :remember
      attr_accessor :remember_token
    
      has_secure_password
    
      def User.new_token
        SecureRandom.urlsafe_base64
      end
    
      def User.digest(token)
        Digest::SHA1.hexdigest(token.to_s)
      end
    
      def remember
        self.remember_token = User.new_token
        update_attribute(:remember_token, User.digest(remember_token))
      end
    
    end
    it's not saving to the remember_token of the user. it keeps coming back nil
    Christopher Cardoso
    @kriscard
    Hi all! I’m using the gem m for my test and I have an issue with rake (my spec doesn’t pass on the last version of rake 12.3.2 so I downgrade to the 12.3.1) but now in my terminal when I put m I have an error with rake but if I do bundle exec m it will works. What can I do to not use bundle exec each times?
    odin-bot
    @odin-bot
    As a side note.. if you got here from a link on the Odin Project website please report it in the discord room so we can fix it. :smile:
    Hi! we have officially moved our chat to Discord! Please come and join us over there by clicking this link: https://discord.gg/hvqVr6d