ruby (3)

Sorting a multi-dimensional array in RubyDecember 01, 2017

Sorting multidimensional works with a few caveats

Recently at work, I’ve been doing some work on a project written in Ruby to enable an endpoint to paginate. Something we need for our mobile apps so we can make a list more performant. In the process of making this work, I ran into a problem with trying to sort a multi-dimensional array. Ruby will look at each index in the nested arrays and compare their indexes to determine which array should…Keep Reading


Setting up a custom variable on your posts that makes it really easy to aggregate posts on a page

Jekyll makes it super easy to create pages and posts and then loop over them to render lists of them. There are a few commands that you can utilize in Liquid to narrow down that list for only rendering a subset of posts or pages. Those are and statements. The statement lets you create new variables that can be referenced on that page as well as any include that happens on that page. And the…Keep Reading


Need to assign a new variable with a subset of an array. Insert slicing.

While liquid has a way to ensure that a for loop will exit once it hits a certain iteration. You may need to slice an array of items outside of a for loop. After some time on Google, I couldn’t find any straight forward way of getting a subset of an array in liquid. I came across a site with some unofficial documentation about strings in liquid. It said it was possible to slice strings. Knowing…Keep Reading


© Matthew Sessions 2022