Iskren's Avatar

Iskren

@izkreny.bsky.social

Ruby and Rails Developer (in training)

15 Followers  |  220 Following  |  5 Posts  |  Joined: 10.02.2026  |  1.7048

Latest posts by izkreny.bsky.social on Bluesky


Preview
Dell Pro 32 inch Plus 4K USB-C Hub Computer Monitor | Dell USA Shop the Dell Pro 32 inch 4k USB-C Hub Monitor is ready-to-work with alls devices, TÜV 4-Star certified for eye comfort. View at Dell.com

I have this not-so-expensive DELL 4K 32-inch monitor for almost half a year, and it is a really nice one, probably cheaper than BENQ (for which I heard also only great words): www.dell.com/en-us/shop/d...

21.02.2026 20:43 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Cassidoo’s Interview question of the week | 444 Hello πŸ‘‹ This week question is about moving numbers. Here it is. You have a 2D grid of numbers. Write a function that zooms in by an integer factor k >= 2 by turning each cell into a k x k block with...

...and although my implement-the-first-obvious-pattern solution is using 4-nested-loops (YUCK!), I won honorably 2nd place in the ad-hoc contest "Whose implementation is the most inefficient one" that we had on Ruby Users Forum: www.rubyforum.org/t/cassidoo-s...

Join us in next week's question! ❀️

21.02.2026 20:22 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
```ruby
module ZoomifyArray
  refine Array do
    def zoom_in_by(factor)
      raise ArgumentError, "Factor MUST be an Integer greater than or equal to 2!" unless factor.is_a?(Integer) && factor >= 2

      number_of_rows = size
      number_of_cols = first.size
      bigger_grid    = Array.new(number_of_rows * factor) { Array.new(number_of_cols * factor) }

      each_with_index do |row, row_index|
        row.each_with_index do |cell, col_index|
          0.upto(factor - 1) do |shift_row_index|
            0.upto(factor - 1) do |shift_col_index|
              bigger_grid[(row_index * factor) + shift_row_index][(col_index * factor) + shift_col_index] = cell
            end
          end
        end
      end

      bigger_grid
    end
  end
end

using ZoomifyArray

# A [monkey-patched](rdoc-ref:Answer::Issue20260216::ZoomifyArray), n00by,
# implement-the-first-obvious-pattern, 'Shameless Green', 4-nested-loops (YUCK!)
# version inspired by the recent exposure to Sandi Metz’s 'Smalltalkism' ---
# I really like the idea of sending messages to the objects! πŸ™ƒ
#
def izkreny_zoom(grid, factor)
  grid.zoom_in_by(factor)
end
```

```ruby module ZoomifyArray refine Array do def zoom_in_by(factor) raise ArgumentError, "Factor MUST be an Integer greater than or equal to 2!" unless factor.is_a?(Integer) && factor >= 2 number_of_rows = size number_of_cols = first.size bigger_grid = Array.new(number_of_rows * factor) { Array.new(number_of_cols * factor) } each_with_index do |row, row_index| row.each_with_index do |cell, col_index| 0.upto(factor - 1) do |shift_row_index| 0.upto(factor - 1) do |shift_col_index| bigger_grid[(row_index * factor) + shift_row_index][(col_index * factor) + shift_col_index] = cell end end end end bigger_grid end end end using ZoomifyArray # A [monkey-patched](rdoc-ref:Answer::Issue20260216::ZoomifyArray), n00by, # implement-the-first-obvious-pattern, 'Shameless Green', 4-nested-loops (YUCK!) # version inspired by the recent exposure to Sandi Metz’s 'Smalltalkism' --- # I really like the idea of sending messages to the objects! πŸ™ƒ # def izkreny_zoom(grid, factor) grid.zoom_in_by(factor) end ```

Exposure to the @sandimetz.bsky.social 'Smalltalkism' (via her amazing POOD-I virtual course! πŸ’œπŸ’šπŸ’™) inspired my monkey-patched quite n00bish and 'Shameless Green' answer to this week's @cassidoo.co interview question: BUT it is such a splendid thing to send messages to the objects!!! πŸ₯°πŸ™ƒπŸ˜Š

21.02.2026 20:20 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Thanks and thank you for your writings! πŸ˜ŠπŸ’œ

11.02.2026 16:33 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
**Given an integer array and a number `n`, move all of the `n`s to the end of the array while maintaining the relative order of the non-`n`s.**
Bonus: do this without making a copy of the array!

Example:
```
$ moveNums([0,2,0,3,10], 0)
$ [2,3,10,0,0]
```

IMPORTANT: Ruby 3.4+ required because of default `it` block parameter!
Methods used:
* [Enumerable#partition](https://docs.ruby-lang.org/en/master/Enumerable.html#method-i-partition)
* [Array#flatten](https://docs.ruby-lang.org/en/master/Array.html#method-i-flatten)

```ruby
def move_numbers(integer_array, number) = integer_array.partition { it != number }.flatten

p move_numbers([ 0, 2, 0, 3, 10 ], 0)  # => [2, 3, 10, 0, 0]
```

NO AI WAS USED IN THE CODING OF THIS SOLUTION! πŸ––

**Given an integer array and a number `n`, move all of the `n`s to the end of the array while maintaining the relative order of the non-`n`s.** Bonus: do this without making a copy of the array! Example: ``` $ moveNums([0,2,0,3,10], 0) $ [2,3,10,0,0] ``` IMPORTANT: Ruby 3.4+ required because of default `it` block parameter! Methods used: * [Enumerable#partition](https://docs.ruby-lang.org/en/master/Enumerable.html#method-i-partition) * [Array#flatten](https://docs.ruby-lang.org/en/master/Array.html#method-i-flatten) ```ruby def move_numbers(integer_array, number) = integer_array.partition { it != number }.flatten p move_numbers([ 0, 2, 0, 3, 10 ], 0) # => [2, 3, 10, 0, 0] ``` NO AI WAS USED IN THE CODING OF THIS SOLUTION! πŸ––

Recently, I discovered @cassidoo.co's colorful and beautifully handcrafted website and immediately subscribed to her insightful and funny weekly newsletter. As a bonus, there is an Interview QOTW inside each one, and this is my answer to the last one. More details: gist.github.com/izkreny/fae8...

11.02.2026 14:21 β€” πŸ‘ 5    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

@izkreny is following 20 prominent accounts