Mistři v programování na #hovnokod


Anonymous,

#Napiste pseudokod, ktery invertuje radky, napr. "abc" -> "cba"

"abc".split("").reverse.join("").to_pseudocode

Anonymous,

columns.each do |c|
        case c
        when 'Device'
          h << c
        when 'Usage'
          h << c
        when 'Status'
          h << c
        when 'Battery'
          h << c
        when 'GPS status'
          h << c
        when 'Wi-Fi status'
          h << c
        when 'Temperature'
          h << c
        when 'Alerts'
          h << c
        end
      end

HovnoKod,

def actual?
    if self.from <= Date.today
      if self.to
        if self.to >= Date.today
          true
        else
          false
        end
      else
        true
      end
    else
      false
    end
  end

HovnoKod,

def make_case_insensitive_expr str
  Regexp.compile str.split('').inject('') { |memo, chr|
    memo << '[]'.insert(1, Regexp.escape(chr.downcase + chr.upcase))
  }
end

HovnoKod,