• 0 Posts
  • 40 Comments
Joined 1 year ago
cake
Cake day: July 31st, 2023

help-circle






  • paholg@lemm.eetoProgrammer Humor@programming.devExam Answer
    link
    fedilink
    English
    arrow-up
    21
    ·
    8 months ago

    Works even better in Ruby, as the code as given is valid, you just need to monkey patch length:

    #!/usr/bin/env ruby
    
    module DayLength
      def length
        if ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].include? self
          "24 hours"
        else
          super
        end
      end
    end
    
    class String
      prepend DayLength
    end
    
    day = "Monday"
    
    x = day.length
    
    print(x)
    

  • paholg@lemm.eetoProgrammer Humor@programming.devExam Answer
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    8 months ago

    It could be Ruby; puts is more common, but there is a print. With some silly context, the answer could even be correct:

    #!/usr/bin/env ruby
    
    module DayLength
      def length
        if ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].include? self
          "24 hours"
        else
          super
        end
      end
    end
    
    class String
      prepend DayLength
    end
    
    day = "Monday"
    
    x = day.length
    
    print(x)
    



  • paholg@lemm.eetoLemmy Shitpost@lemmy.worldPlease Stop
    link
    fedilink
    English
    arrow-up
    4
    ·
    8 months ago

    The only selling point of blockchain is that it’s trustless. This becomes a less-useful property when it comes to things in the real world, as you tend to need to trust at least one party.

    For example, anything they achieved there with blockchain, they could have achieved with a simple government-run web service and a traditional database.


  • paholg@lemm.eetoLemmy Shitpost@lemmy.worldPlease Stop
    link
    fedilink
    English
    arrow-up
    15
    arrow-down
    1
    ·
    8 months ago

    That is not a use for blockchain.

    Say I want to say that I created an image. I could post that image’s hash to a block chain, and point to it as something anyone can check.

    But you already have to trust me for that to be valuable. So I can just host that hash in any of a myriad of conventional methods that are simpler, more performant, and less wasteful.







  • paholg@lemm.eetoLemmy Shitpost@lemmy.worldAverage website visit in 2024
    link
    fedilink
    English
    arrow-up
    32
    arrow-down
    9
    ·
    9 months ago

    Hear me out: part of me welcomes that.

    Currently, most websites are awful to browse, and a few are not. If we switch to a world where most are inaccessible to me, and a few are nice, then I’ll spend less time being frustrated by cookie popups and the like.

    Like, if a site’s going to be terrible, I almost prefer it just not let me in at all.