[-] snowe@programming.dev 4 points 2 years ago

I thought it was adblocks latest update.

[-] snowe@programming.dev 4 points 2 years ago* (last edited 2 years ago)

Ruby

!ruby@programming.dev [LANGUAGE: Ruby]

I found today really easy thankfully. Hardest part was remembering the language features haha

https://github.com/snowe2010/advent-of-code/blob/master/ruby_aoc/2023/day09/day09.rb

edit: code golfing this one was easy too! man this day really worked out huh

    def get_subsequent_reading(reading)
      puts "passed in readings #{reading}"
      if reading.all?(0)
        reading << 0
      else
        readings = reading.each_cons(2).map do |a, b|
          b - a
        end
        sub_reading = get_subsequent_reading(readings)
        reading << (reading[-1] + sub_reading[-1])
        puts "current reading #{reading}"
        reading
      end
    end
    
    execute(1) do |lines|
      lines.map do |reading|
        get_subsequent_reading(reading.split.map(&:to_i))
      end.map {|arr| arr[-1]}.sum
    end
    
    
    def get_preceeding_readings(reading)
      puts "passed in readings #{reading}"
      if reading.all?(0)
        reading.unshift(0)
      else
        readings = reading.each_cons(2).map do |a, b|
          b - a
        end
        sub_reading = get_preceeding_readings(readings)
        reading.unshift(reading[0] - sub_reading[0])
        puts "current reading #{readings} #{sub_reading}"
        reading
      end
    end
    
    
    execute(2, test_only: false, test_file_suffix: '') do |lines|
      lines.map do |reading|
        get_preceeding_readings(reading.split.map(&:to_i))
      end.map {|arr| arr[0]}.sum
    end

code golf

  a=->r{r.unshift(r.all?(0)?0:(r[0]-a[r.each_cons(2).map{_2-_1}][0]))}
  l.map{a[_1.split.map(&:to_i)]}.map{_1[0]}.sum
[-] snowe@programming.dev 4 points 2 years ago

I making a point that you seem to be missing. If you have to point out some way to get around a problem that any given user will have with a piece of software, then that’s why your software is not being used. This is the continual problem with the Linux community, they think that everyone wants to learn this stuff. Most people just want their software to work. They don’t want to have to do any sort of googling to figure out why it’s crashing or why it’s running slow or why it doesn’t have this or that feature. Every time someone like you tries to point out that someone can just google something you lose another person that may have been willing to use FOSS in the future. Instead, maybe go try to fix their problem because they sure as hell aren’t going to.

[-] snowe@programming.dev 4 points 2 years ago* (last edited 2 years ago)

Ruby

https://github.com/snowe2010/advent-of-code/blob/master/ruby_aoc/2023/day02/day02.rb

Second part was soooo much easier today than yesterday. Helps I solved it exactly how he wanted you to solve it I think.

I'm going to work on some code golf now.

Golfed P2 down to 133 characters:

p g.map{_1.sub!(/.*:/,'')
m=Hash.new(0)
_1.split(?;){|r|r.split(?,){|a|b,c=a.split
m[c]=[m[c],b.to_i].max}}
m.values.reduce(&:*)}.sum
[-] snowe@programming.dev 4 points 2 years ago

75% of vehicle sales in Sweden are EVs https://cleantechnica.com/2023/01/03/plugin-evs-take-record-75-share-of-swedens-auto-market/

The two bestselling EVs in that article are the Volvo xc40 and the VW ID.4. Both of which are less than $45k usd (480,000 SEK for the xc40 and here’s a used ID.4 for 370k).

This myth that EVs are expensive has really got to go. The Nissan leaf has been available for over a decade at a super cheap price point. Here’s a Nissan leaf for sale for $8k USD/90k SEK. https://www.car.info/en-se/car-for-sale/nissan-leaf-24-kwh-109ps-2012-at-bossloh-co-bil-40876608

[-] snowe@programming.dev 4 points 3 years ago

I’m curious as to what reward you believe that people are getting from closing questions?

there's a bunch of badges for things that can only be accomplished by flagging.

You also get the nice 'feeling' of clearing your queue. The faster you do that the better you feel. It's literally all rewards for putting as little effort in to get as much 'reward' as possible.

[-] snowe@programming.dev 4 points 3 years ago

Neither Reddit nor lemmy meet the actual requirements of social media.

  1. Knowing the people you are talking to. Both Reddit and lemmy are anonymous
  2. Status updates on some sort of timeline.

Lemmy and Reddit are forums of forums, and if you want to get more specific they’re link aggregators. Nobody ever called the car forum you visited to ask for car help “social media” because it wasn’t and still isn’t. Same applies to lemmy and Reddit.

[-] snowe@programming.dev 4 points 3 years ago

Haha I wonder how many people have actually seen this movie.

[-] snowe@programming.dev 4 points 3 years ago

This hits a little two close to home…

[-] snowe@programming.dev 4 points 3 years ago

I'm definitely missing something here. I'm terrible at rust and c++

[-] snowe@programming.dev 4 points 3 years ago

the part where if it compiles it will almost 100% of the time work. Of course, that's not completely the case with some of the database stuff, but pretty much everything else works.

[-] snowe@programming.dev 4 points 3 years ago

I’d like for the r/rust community to completely migrate to lemmy, and for the r/rust moderators to become moderators of the chosen lemmy instance.

If the /r/rust moderators join programming.dev I will immediately make them mods of !rust@programming.dev!

view more: ‹ prev next ›

snowe

0 post score
0 comment score
joined 3 years ago
MODERATOR OF